Prusa MINI Firmware overview
window_dlg_preheat.h File Reference
#include "window.h"
#include "window_text.h"
#include "window_list.h"

Go to the source code of this file.

Classes

struct  _window_dlg_preheat_t
 
struct  _window_class_dlg_preheat_t
 

Typedefs

typedef struct _window_dlg_preheat_t window_dlg_preheat_t
 
typedef void() dlg_on_click_cb(window_dlg_preheat_t *)
 
typedef struct _window_class_dlg_preheat_t window_class_dlg_preheat_t
 

Functions

int gui_dlg_preheat (const char *caption)
 
int gui_dlg_preheat_autoselect_if_able (const char *caption)
 
int gui_dlg_preheat_forced (const char *caption)
 
int gui_dlg_preheat_autoselect_if_able_forced (const char *caption)
 
int gui_dlg_list (const char *caption, window_list_item_t *filament_items, dlg_on_click_cb *on_click, size_t count, int32_t ttl)
 

Variables

int16_t WINDOW_CLS_DLG_PREHEAT
 
const window_class_dlg_preheat_t window_class_dlg_preheat
 

Typedef Documentation

◆ window_dlg_preheat_t

◆ dlg_on_click_cb

typedef void() dlg_on_click_cb(window_dlg_preheat_t *)

◆ window_class_dlg_preheat_t

Function Documentation

◆ gui_dlg_preheat()

int gui_dlg_preheat ( const char *  caption)
126  {
127  return gui_dlg_list(
128  caption,
131  _PREHEAT_FILAMENT_CNT + 1, //+1 back option
132  30000);
133 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_dlg_preheat_autoselect_if_able()

int gui_dlg_preheat_autoselect_if_able ( const char *  caption)
135  {
136  const FILAMENT_t fil = get_filament();
137  if (fil == FILAMENT_NONE) {
138  //no filament selected
139  return gui_dlg_preheat(caption);
140  } else {
141  //when filament is known, but heating is off, just turn it on and do not ask
143  if (p_vars->target_nozzle != filaments[fil].nozzle) {
144  marlin_gcode_printf("M104 S%d", (int)filaments[fil].nozzle);
145  marlin_gcode_printf("M140 S%d", (int)filaments[fil].heatbed);
146  }
147  }
148  return fil;
149 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_dlg_preheat_forced()

int gui_dlg_preheat_forced ( const char *  caption)
152  {
153  return gui_dlg_list(
154  caption,
158  -1 //do not leave
159  );
160 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_dlg_preheat_autoselect_if_able_forced()

int gui_dlg_preheat_autoselect_if_able_forced ( const char *  caption)
163  {
164  const FILAMENT_t fil = get_filament();
165  if (fil == FILAMENT_NONE) {
166  //no filament selected
167  return gui_dlg_preheat_forced(caption);
168  } else {
169  //when filament is known, but heating is off, just turn it on and do not ask
171  if (p_vars->target_nozzle != filaments[fil].nozzle) {
172  marlin_gcode_printf("M104 S%d", (int)filaments[fil].nozzle);
173  marlin_gcode_printf("M140 S%d", (int)filaments[fil].heatbed);
174  }
175  }
176  return fil;
177 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_dlg_list()

int gui_dlg_list ( const char *  caption,
window_list_item_t filament_items,
dlg_on_click_cb on_click,
size_t  count,
int32_t  ttl 
)
184  {
186  dlg.caption = caption;
187  dlg.filament_items = filament_items;
188  dlg.on_click = on_click;
189  //dlg.filaments_count = count;
190 
191  //parent 0 would be first screen
192  //here must be -1
193  int16_t id_capture = window_capture();
195 
196  window_set_item_count(dlg.list.win.id, count);
197 
198  window_1 = (window_t *)&dlg;
199  window_set_capture(dlg.list.win.id); //get inside list
200 
201  gui_reset_jogwheel();
202  gui_invalidate();
203 
204  //window_disable(id);
205 
206  dlg.timer = HAL_GetTick();
207 
208  //ttl retyped to uint - so "-1" == for ever (or very long)
209  while ((dlg.timer != -1) && ((uint32_t)(HAL_GetTick() - dlg.timer) < (uint32_t)ttl)) {
210  gui_loop();
211  }
212 
213  int ret;
214  if (dlg.timer != -1) {
215  ret = -1;
216  } else {
217  ret = dlg.list.index;
218  }
219 
220  window_destroy(id); //msg box does not call this, should I
222  window_set_capture(id_capture);
223  return ret;
224 }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ WINDOW_CLS_DLG_PREHEAT

int16_t WINDOW_CLS_DLG_PREHEAT

◆ window_class_dlg_preheat

const window_class_dlg_preheat_t window_class_dlg_preheat
window_capture
int16_t window_capture(void)
Definition: window.c:169
_window_dlg_preheat_t::on_click
dlg_on_click_cb * on_click
Definition: window_dlg_preheat.h:36
FILAMENT_NONE
Definition: filament.h:26
_window_dlg_preheat_t::list
window_list_t list
Definition: window_dlg_preheat.h:34
window_list_filament_item_cb
void window_list_filament_item_cb(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: window_dlg_preheat.c:39
gui_dlg_preheat
int gui_dlg_preheat(const char *caption)
Definition: window_dlg_preheat.c:126
window_invalidate
void window_invalidate(int16_t id)
Definition: window.c:304
window_destroy
void window_destroy(int16_t id)
Definition: window.c:132
fil
FIL fil
Definition: pngview.c:11
_gui_defaults_t::msg_box_sz
rect_ui16_t msg_box_sz
Definition: guitypes.h:114
WINDOW_CLS_DLG_PREHEAT
int16_t WINDOW_CLS_DLG_PREHEAT
Definition: window_dlg_preheat.c:22
filaments
const filament_t filaments[FILAMENTS_END]
Definition: filament.cpp:20
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
_window_t::id
int16_t id
Definition: window.h:79
_window_list_t::win
window_t win
Definition: window_list.h:16
gui_invalidate
void gui_invalidate(void)
Definition: gui.c:66
_window_dlg_preheat_t::filament_items
window_list_item_t * filament_items
Definition: window_dlg_preheat.h:35
_window_t
Definition: window.h:76
get_filament
FILAMENT_t get_filament()
Definition: filament.cpp:41
_marlin_vars_t::target_nozzle
float target_nozzle
Definition: marlin_vars.h:85
filament_t::nozzle
uint16_t nozzle
Definition: filament.h:19
gui_dlg_preheat_forced
int gui_dlg_preheat_forced(const char *caption)
Definition: window_dlg_preheat.c:152
window_set_capture
void window_set_capture(int16_t id)
Definition: window.c:500
marlin_update_vars
marlin_vars_t * marlin_update_vars(uint64_t msk)
Definition: marlin_client.c:368
MARLIN_VAR_MSK
#define MARLIN_VAR_MSK(v_id)
Definition: marlin_vars.h:35
_window_dlg_preheat_t
Definition: window_dlg_preheat.h:24
_window_dlg_preheat_t::timer
uint32_t timer
Definition: window_dlg_preheat.h:31
window_create_ptr
int16_t window_create_ptr(int16_t cls_id, int16_t id_parent, rect_ui16_t rect, void *ptr)
Definition: window.c:102
_window_list_t::index
int index
Definition: window_list.h:24
window_dlg_preheat_click_cb
void window_dlg_preheat_click_cb(window_dlg_preheat_t *window)
Definition: window_dlg_preheat.c:60
gui_dlg_list
int gui_dlg_list(const char *caption, window_list_item_t *filament_items, dlg_on_click_cb *on_click, size_t count, int32_t ttl)
Definition: window_dlg_preheat.c:183
_marlin_vars_t
Definition: marlin_vars.h:77
FILAMENT_t
FILAMENT_t
Definition: filament.h:25
_PREHEAT_FILAMENT_CNT
#define _PREHEAT_FILAMENT_CNT
Definition: window_dlg_preheat.c:26
window_1
window_t * window_1
Definition: window.c:14
gui_defaults
gui_defaults_t gui_defaults
Definition: gui.c:20
MARLIN_VAR_TTEM_NOZ
#define MARLIN_VAR_TTEM_NOZ
Definition: marlin_vars.h:21
window_set_item_count
void window_set_item_count(int16_t id, int count)
Definition: window.c:573
nozzle
Nozzle nozzle
Definition: nozzle.cpp:29
_window_dlg_preheat_t::caption
const char * caption
Definition: window_dlg_preheat.h:37
marlin_gcode_printf
int marlin_gcode_printf(const char *format,...)
Definition: marlin_client.c:206
window_list_filament_item_forced_cb
void window_list_filament_item_forced_cb(window_list_t *pwindow_list, uint16_t index, const char **pptext, uint16_t *pid_icon)
Definition: window_dlg_preheat.c:29
window_dlg_preheat_click_forced_cb
void window_dlg_preheat_click_forced_cb(window_dlg_preheat_t *window)
Definition: window_dlg_preheat.c:55