ultralcd.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "mesh_bed_calibration.h"
  4. #include "config.h"
  5. extern void menu_lcd_longpress_func(void);
  6. extern void menu_lcd_charsetup_func(void);
  7. extern void menu_lcd_lcdupdate_func(void);
  8. // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
  9. void ultralcd_init();
  10. void lcd_setstatus(const char* message);
  11. void lcd_setstatuspgm(const char* message);
  12. //! LCD status severities
  13. #define LCD_STATUS_CRITICAL 2 //< Heater failure
  14. #define LCD_STATUS_ALERT 1 //< Other hardware issue
  15. #define LCD_STATUS_NONE 0 //< No alert message set
  16. //! return to the main status screen and display the alert message
  17. //! Beware - it has sideeffects:
  18. //! - always returns the display to the main status screen
  19. //! - always makes lcd_reset (which is slow and causes flicker)
  20. //! - does not update the message if there is one with the same (or higher) severity present
  21. void lcd_setalertstatus(const char* message, uint8_t severity = LCD_STATUS_ALERT);
  22. void lcd_setalertstatuspgm(const char* message, uint8_t severity = LCD_STATUS_ALERT);
  23. //! only update the alert message on the main status screen
  24. //! has no sideeffects, may be called multiple times
  25. void lcd_updatestatus(const char *message);
  26. void lcd_updatestatuspgm(const char *message);
  27. void lcd_reset_alert_level();
  28. uint8_t get_message_level();
  29. void lcd_adjust_z();
  30. void lcd_pick_babystep();
  31. void lcd_alright();
  32. void show_preheat_nozzle_warning();
  33. void EEPROM_save_B(int pos, int* value);
  34. void EEPROM_read_B(int pos, int* value);
  35. void lcd_wait_interact();
  36. void lcd_loading_filament();
  37. void lcd_change_success();
  38. void lcd_loading_color();
  39. void lcd_sdcard_stop();
  40. void lcd_pause_print();
  41. void lcd_pause_usb_print();
  42. void lcd_resume_print();
  43. void lcd_print_stop();
  44. void prusa_statistics(uint8_t _message, uint8_t _col_nr = 0);
  45. void lcd_load_filament_color_check();
  46. //void lcd_mylang();
  47. extern void lcd_belttest();
  48. extern bool lcd_selftest();
  49. void lcd_menu_statistics();
  50. void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  51. void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  52. void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  53. #ifdef TMC2130
  54. bool lcd_crash_detect_enabled();
  55. void lcd_crash_detect_enable();
  56. void lcd_crash_detect_disable();
  57. #endif
  58. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  59. extern const char* lcd_display_message_fullscreen_P(const char *msg);
  60. extern void lcd_return_to_status();
  61. extern void lcd_wait_for_click();
  62. extern bool lcd_wait_for_click_delay(uint16_t nDelay);
  63. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  64. // 0: no, 1: yes, -1: timeouted
  65. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  66. extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
  67. const char *first_choice, const char *second_choice);
  68. extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  69. // Ask the user to move the Z axis up to the end stoppers and let
  70. // the user confirm that it has been done.
  71. #ifndef TMC2130
  72. extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
  73. #endif
  74. // Show the result of the calibration process on the LCD screen.
  75. extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
  76. extern void lcd_diag_show_end_stops();
  77. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  78. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  79. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  80. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  81. // To be used in lcd_commands_type.
  82. enum class LcdCommands : uint_least8_t
  83. {
  84. Idle,
  85. LoadFilament,
  86. StopPrint,
  87. FarmModeConfirm,
  88. LongPause,
  89. PidExtruder,
  90. Layer1Cal,
  91. };
  92. extern LcdCommands lcd_commands_type;
  93. extern int8_t FSensorStateMenu;
  94. enum class CustomMsg : uint_least8_t
  95. {
  96. Status, //!< status message from lcd_status_message variable
  97. MeshBedLeveling, //!< Mesh bed leveling in progress
  98. FilamentLoading, //!< Loading filament in progress
  99. PidCal, //!< PID tuning in progress
  100. TempCal, //!< PINDA temperature calibration
  101. TempCompPreheat, //!< Temperature compensation preheat
  102. M0Wait, //!< M0/M1 Wait command working even from SD
  103. MsgUpdate, //!< Short message even while printing from SD
  104. Resuming, //!< Resuming message
  105. };
  106. extern CustomMsg custom_message_type;
  107. extern uint8_t custom_message_state;
  108. extern uint8_t farm_mode;
  109. extern bool UserECoolEnabled();
  110. extern bool FarmOrUserECool();
  111. #ifdef TMC2130
  112. #define SILENT_MODE_NORMAL 0
  113. #define SILENT_MODE_STEALTH 1
  114. #define SILENT_MODE_OFF SILENT_MODE_NORMAL
  115. #else
  116. #define SILENT_MODE_POWER 0
  117. #define SILENT_MODE_SILENT 1
  118. #define SILENT_MODE_AUTO 2
  119. #define SILENT_MODE_OFF SILENT_MODE_POWER
  120. #endif
  121. #ifdef IR_SENSOR_ANALOG
  122. extern bool bMenuFSDetect;
  123. void printf_IRSensorAnalogBoardChange();
  124. #endif //IR_SENSOR_ANALOG
  125. extern int8_t SilentModeMenu;
  126. extern uint8_t SilentModeMenu_MMU;
  127. extern bool cancel_heatup;
  128. extern bool isPrintPaused;
  129. extern uint8_t scrollstuff;
  130. void lcd_ignore_click(bool b=true);
  131. void lcd_commands();
  132. extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function
  133. void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()")
  134. void change_extr(int extr);
  135. #ifdef SNMM
  136. void extr_unload_all();
  137. void extr_unload_used();
  138. #endif //SNMM
  139. void extr_unload();
  140. enum class FilamentAction : uint_least8_t
  141. {
  142. None, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
  143. Load,
  144. AutoLoad,
  145. UnLoad,
  146. MmuLoad,
  147. MmuUnLoad,
  148. MmuEject,
  149. MmuCut,
  150. Preheat,
  151. Lay1Cal,
  152. };
  153. extern FilamentAction eFilamentAction;
  154. extern bool bFilamentFirstRun;
  155. extern bool bFilamentPreheatState;
  156. extern bool bFilamentAction;
  157. void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
  158. void mFilamentItemForce();
  159. void lcd_generic_preheat_menu();
  160. void unload_filament(bool automatic = false);
  161. void lcd_printer_connected();
  162. void lcd_ping();
  163. void lcd_calibrate_extruder();
  164. void lcd_wait_for_heater();
  165. void lcd_wait_for_cool_down();
  166. void lcd_move_e(); // NOT static due to usage in Marlin_main
  167. void lcd_extr_cal_reset();
  168. void lcd_temp_cal_show_result(bool result);
  169. #ifdef PINDA_THERMISTOR
  170. bool lcd_wait_for_pinda(float temp);
  171. #endif //PINDA_THERMISTOR
  172. void bowden_menu();
  173. char reset_menu();
  174. uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
  175. void lcd_pinda_calibration_menu();
  176. void lcd_calibrate_pinda();
  177. void lcd_temp_calibration_set();
  178. void display_loading();
  179. void lcd_set_degree();
  180. #if (LANG_MODE != 0)
  181. void lcd_language();
  182. #endif
  183. void lcd_wizard();
  184. bool lcd_autoDepleteEnabled();
  185. //! @brief Wizard state
  186. enum class WizState : uint8_t
  187. {
  188. Run, //!< run wizard? Main entry point.
  189. Restore, //!< restore calibration status
  190. Selftest, //!< self test
  191. Xyz, //!< xyz calibration
  192. Z, //!< z calibration
  193. IsFil, //!< Is filament loaded? First step of 1st layer calibration
  194. PreheatPla, //!< waiting for preheat nozzle for PLA
  195. Preheat, //!< Preheat for any material
  196. LoadFilCold, //!< Load filament for MMU
  197. LoadFilHot, //!< Load filament without MMU
  198. IsPla, //!< Is PLA filament?
  199. Lay1CalCold, //!< First layer calibration, temperature not selected yet
  200. Lay1CalHot, //!< First layer calibration, temperature already selected
  201. RepeatLay1Cal, //!< Repeat first layer calibration?
  202. Finish, //!< Deactivate wizard
  203. };
  204. void lcd_wizard(WizState state);
  205. extern void lcd_experimental_toggle();
  206. extern void lcd_experimental_menu();
  207. #ifdef PINDA_TEMP_COMP
  208. extern void lcd_pinda_temp_compensation_toggle();
  209. #endif //PINDA_TEMP_COMP
  210. #endif //ULTRALCD_H