Prusa3d Marlin fork
ultralcd.h
1 #ifndef ULTRALCD_H
2 #define ULTRALCD_H
3 
4 #include "mesh_bed_calibration.h"
5 #include "config.h"
6 
7 extern void menu_lcd_longpress_func(void);
8 extern void menu_lcd_lcdupdate_func(void);
9 
10 // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
11 void ultralcd_init();
12 
14 #define LCD_STATUS_CRITICAL 3 //< Heater failure
15 #define LCD_STATUS_ALERT 2 //< Other hardware issue
16 #define LCD_STATUS_INFO 1 //< Message times out after a while
17 #define LCD_STATUS_NONE 0 //< No alert message set
18 
19 #define LCD_STATUS_INFO_TIMEOUT 20000
20 #define LCD_STATUS_DELAYED_TIMEOUT 4000
21 
22 // Reprint
23 void lcd_reprint_from_eeprom();
24 
25 // Set the current status message (equivalent to LCD_STATUS_NONE)
26 void lcdui_print_status_line(void);
27 void lcd_clearstatus();
28 
31 void lcd_getstatus(char buf[LCD_WIDTH]);
32 void lcd_insert_char_into_status(uint8_t position, const char message);
33 void lcd_setstatus(const char* message);
34 void lcd_setstatuspgm(const char* message);
35 void lcd_setstatus_serial(const char* message);
36 void lcd_reset_status_message_timeout();
37 
43 void lcd_setalertstatus(const char* message, uint8_t severity = LCD_STATUS_ALERT);
44 void lcd_setalertstatuspgm(const char* message, uint8_t severity = LCD_STATUS_ALERT);
45 
47 uint8_t get_message_level();
48 void lcd_reset_alert_level();
49 
50 void lcd_pick_babystep();
51 uint8_t lcd_alright();
52 void show_preheat_nozzle_warning();
53 void lcd_wait_interact();
54 void lcd_loading_filament();
55 void lcd_change_success();
56 void lcd_loading_color();
57 void lcd_sdcard_stop();
58 void lcd_pause_print();
59 void lcd_pause_usb_print();
61 void lcd_resume_print();
62 void lcd_print_stop(); // interactive print stop
63 
67 void print_stop(bool interactive=false, bool unconditional_stop=false);
68 #ifdef THERMAL_MODEL
69 void lcd_thermal_model_cal();
70 #endif //THERMAL_MODEL
71 void lcd_load_filament_color_check();
72 
73 extern void lcd_belttest();
74 extern bool lcd_selftest();
75 
76 void lcd_menu_statistics();
77 
78 void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
79 void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
80 void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
81 
82 enum LCDButtonChoice : uint_fast8_t {
83  LCD_LEFT_BUTTON_CHOICE = 0,
84  LCD_MIDDLE_BUTTON_CHOICE = 1,
85  LCD_RIGHT_BUTTON_CHOICE = 2,
86  LCD_BUTTON_TIMEOUT = 0xFF,
87 };
88 
89 extern const char* lcd_display_message_fullscreen_P(const char *msg);
90 
91 extern void lcd_return_to_status();
92 extern void lcd_wait_for_click();
93 extern bool lcd_wait_for_click_delay(uint16_t nDelay);
94 void lcd_show_choices_prompt_P(uint8_t selected, const char *first_choice, const char *second_choice, uint8_t second_col, const char *third_choice = nullptr);
95 extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
96 extern uint8_t lcd_show_yes_no_and_wait(bool allow_timeouting = true, uint8_t default_selection = LCD_MIDDLE_BUTTON_CHOICE);
97 extern uint8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, uint8_t default_selection = LCD_MIDDLE_BUTTON_CHOICE);
99  const char * const msg, bool allow_timeouting, uint8_t default_selection,
100  const char * const first_choice, const char * const second_choice, const char * const third_choice = nullptr,
101  uint8_t second_col = 7);
102 extern uint8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, uint8_t default_selection = LCD_MIDDLE_BUTTON_CHOICE);
103 // Ask the user to move the Z axis up to the end stoppers and let
104 // the user confirm that it has been done.
105 
106 #ifndef TMC2130
107 extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
108 extern void lcd_diag_show_end_stops();
109 #endif
110 
111 // Show the result of the calibration process on the LCD screen.
112 extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
113 
114 
115 #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
116 #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
117 #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
118 #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
119 
120 
121 // To be used in lcd_commands_type.
122 enum class LcdCommands : uint_least8_t
123 {
124  Idle,
125  StopPrint,
126  LongPause,
127  PidExtruder,
128  Layer1Cal,
129 #ifdef THERMAL_MODEL
130  ThermalModel,
131 #endif //THERMAL_MODEL
132  NozzleCNG,
133 };
134 
135 extern LcdCommands lcd_commands_type;
136 
137 enum class CustomMsg : uint_least8_t
138 {
139  Status,
140  MeshBedLeveling,
141  FilamentLoading,
142  PidCal,
143  TempCal,
144  TempCompPreheat,
145  M0Wait,
146  M117,
147  Resuming,
148  MMUProgress,
149 };
150 
151 extern CustomMsg custom_message_type;
152 extern uint8_t custom_message_state;
153 
154 extern bool UserECoolEnabled();
155 extern bool FarmOrUserECool();
156 
157 #ifdef TMC2130
158 #define SILENT_MODE_NORMAL 0
159 #define SILENT_MODE_STEALTH 1
160 #define SILENT_MODE_OFF SILENT_MODE_NORMAL
161 #else
162 #define SILENT_MODE_POWER 0
163 #define SILENT_MODE_SILENT 1
164 #define SILENT_MODE_AUTO 2
165 #define SILENT_MODE_OFF SILENT_MODE_POWER
166 #endif
167 
168 #if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
169 void printf_IRSensorAnalogBoardChange();
170 #endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
171 
172 extern int8_t SilentModeMenu;
173 
174 extern uint8_t scrollstuff;
175 
176 
177 void lcd_commands();
178 
179 
180 extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function
181 void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()")
182 
183 enum class FilamentAction : uint_least8_t
184 {
185  None, // no filament action is taking place
186  Load,
187  AutoLoad, // triggered by insertion, cancellable until it transitions to Load
188  UnLoad,
189  MmuLoad,
190  MmuUnLoad,
191  MmuEject,
192  MmuCut,
193  MmuLoadingTest,
194  Preheat, // triggered by preheat (cancellable)
195  Lay1Cal, // triggered by 1st layer calibration (cancellable)
196 };
197 
198 extern FilamentAction eFilamentAction;
199 void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
200 void lcd_generic_preheat_menu();
201 void unload_filament(float unloadLength);
202 void lcd_AutoLoadFilament();
203 
204 
205 void lcd_wait_for_heater();
206 void lcd_wait_for_cool_down();
207 void lcd_move_e(); // NOT static due to usage in Marlin_main
208 
209 void lcd_temp_cal_show_result(bool result);
210 #ifdef PINDA_THERMISTOR
211 bool lcd_wait_for_pinda(float temp);
212 #endif //PINDA_THERMISTOR
213 
214 
215 char reset_menu();
216 uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
217 
218 void lcd_calibrate_pinda();
219 void lcd_temp_calibration_set();
220 
221 #if (LANG_MODE != 0)
222 void lcd_language();
223 #endif
224 
225 void lcd_wizard();
226 
228 enum class WizState : uint8_t
229 {
230  Run,
231  Restore,
232  Selftest,
233  Xyz,
234  Z,
235 #ifdef THERMAL_MODEL
236  ThermalModel,
237 #endif //THERMAL_MODEL
238  IsFil,
239  Preheat,
240  LoadFilCold,
241  LoadFilHot,
242  Lay1CalCold,
243  Lay1CalHot,
244  RepeatLay1Cal,
245  Finish,
246  Failed,
247 };
248 
249 void lcd_wizard(WizState state);
250 
251 extern void lcd_experimental_menu();
252 
253 uint8_t lcdui_print_extruder(void);
254 
255 #ifdef PINDA_TEMP_COMP
256 extern void lcd_pinda_temp_compensation_toggle();
257 #endif //PINDA_TEMP_COMP
258 
259 extern void lcd_heat_bed_on_load_toggle();
260 
261 #ifdef COMMUNITY_PREVENT_OOZE
262 extern void retract_for_ooze_prevention();
263 #endif //COMMUNITY_PREVENT_OOZE
264 
265 #endif //ULTRALCD_H
void lcd_pause_usb_print()
Send host action "pause".
Definition: ultralcd.cpp:1051
void lcd_pause_print()
Pause print, disable nozzle heater, move to park position, send host action "paused".
Definition: ultralcd.cpp:1034
void lcd_send_action_start()
Send host action "start".
Definition: ultralcd.cpp:7537
void lcd_setalertstatus(const char *message, uint8_t severity)
Definition: ultralcd.cpp:7277
void unload_filament(float unloadLength)
unload filament for single material printer (used in M600 and M702)
Definition: ultralcd.cpp:4908
void lcd_getstatus(char buf[LCD_WIDTH])
Copy the contents of lcd_status_message.
Definition: ultralcd.cpp:7237
void ultralcd_init()
Definition: ultralcd.cpp:7159
uint8_t lcd_show_yes_no_and_wait(bool allow_timeouting, uint8_t default_selection)
Display and wait for a Yes/No choice using the last line of the LCD.
Definition: ultralcd.cpp:3145
uint8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting, uint8_t default_selection)
Show multiple screen message with yes and no possible choices and wait with possible timeout.
Definition: ultralcd.cpp:3027
void lcd_show_choices_prompt_P(uint8_t selected, const char *first_choice, const char *second_choice, uint8_t second_col, const char *third_choice)
Show a two-choice prompt on the last line of the LCD.
Definition: ultralcd.cpp:3037
void lcd_resume_print()
Resume paused print, send host action "resumed".
Definition: ultralcd.cpp:5015
void lcd_hw_setup_menu(void)
Definition: ultralcd.cpp:4401
void lcd_menu_statistics()
Show filament used a print time.
Definition: ultralcd.cpp:2328
bool lcd_selftest()
Definition: ultralcd.cpp:6040
void retract_for_ooze_prevention()
Retract filament to prevent oozing.
Definition: ultralcd.cpp:5662
uint8_t get_message_level()
Get/reset the current alert level.
Definition: ultralcd.cpp:7292
void lcd_show_fullscreen_message_and_wait_P(const char *msg)
show full screen message and wait
Definition: ultralcd.cpp:2961
bool UserECoolEnabled()
Definition: ultralcd.cpp:7461
void lcdui_print_status_line(void)
@Brief Print status line on status screen
Definition: ultralcd.cpp:511
void print_stop(bool interactive, bool unconditional_stop)
Stop the print immediately.
Definition: ultralcd.cpp:5730
void lcd_wizard(WizState state)
Printer first run wizard (Selftest and calibration)
Definition: ultralcd.cpp:3777
void lcd_menu_extruder_info()
Show Extruder Info.
Definition: ultralcd.cpp:1101
uint8_t lcd_show_multiscreen_message_with_choices_and_wait_P(const char *const msg, bool allow_timeouting, uint8_t default_selection, const char *const first_choice, const char *const second_choice, const char *const third_choice, uint8_t second_col)
Show single or multiple screen message with two possible choices and wait with possible timeout.
Definition: ultralcd.cpp:3061
uint8_t choose_menu_P(const char *header, const char *item, const char *last_item)
Select one of numbered items.
Definition: ultralcd.cpp:4619