ultralcd.h 8.0 KB

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