ultralcd.h 8.4 KB

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