ultralcd.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "Marlin.h"
  4. #include "lcd.h"
  5. #include "conv2str.h"
  6. #include "menu.h"
  7. #include "mesh_bed_calibration.h"
  8. #include "config.h"
  9. #include "config.h"
  10. extern void menu_lcd_longpress_func(void);
  11. extern void menu_lcd_charsetup_func(void);
  12. extern void menu_lcd_lcdupdate_func(void);
  13. // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
  14. void ultralcd_init();
  15. void lcd_setstatus(const char* message);
  16. void lcd_setstatuspgm(const char* message);
  17. //! return to the main status screen and display the alert message
  18. //! Beware - it has sideeffects:
  19. //! - always returns the display to the main status screen
  20. //! - always makes lcd_reset (which is slow and causes flicker)
  21. //! - does not update the message if there is already one (i.e. lcd_status_message_level > 0)
  22. void lcd_setalertstatus(const char* message);
  23. void lcd_setalertstatuspgm(const char* message);
  24. //! only update the alert message on the main status screen
  25. //! has no sideeffects, may be called multiple times
  26. void lcd_updatestatus(const char *message);
  27. void lcd_updatestatuspgm(const char *message);
  28. void lcd_reset_alert_level();
  29. uint8_t get_message_level();
  30. void lcd_adjust_z();
  31. void lcd_pick_babystep();
  32. void lcd_alright();
  33. void show_preheat_nozzle_warning();
  34. void EEPROM_save_B(int pos, int* value);
  35. void EEPROM_read_B(int pos, int* value);
  36. void lcd_wait_interact();
  37. void lcd_loading_filament();
  38. void lcd_change_success();
  39. void lcd_loading_color();
  40. void lcd_sdcard_stop();
  41. void lcd_pause_print();
  42. void lcd_pause_usb_print();
  43. void lcd_resume_print();
  44. void lcd_print_stop();
  45. void prusa_statistics(int _message, uint8_t _col_nr = 0);
  46. unsigned char lcd_choose_color();
  47. void lcd_load_filament_color_check();
  48. //void lcd_mylang();
  49. extern void lcd_belttest();
  50. extern bool lcd_selftest();
  51. void lcd_menu_statistics();
  52. void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  53. void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  54. void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
  55. #ifdef TMC2130
  56. bool lcd_crash_detect_enabled();
  57. void lcd_crash_detect_enable();
  58. void lcd_crash_detect_disable();
  59. #endif
  60. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  61. extern const char* lcd_display_message_fullscreen_P(const char *msg);
  62. extern void lcd_return_to_status();
  63. extern void lcd_wait_for_click();
  64. extern bool lcd_wait_for_click_delay(uint16_t nDelay);
  65. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  66. // 0: no, 1: yes, -1: timeouted
  67. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  68. extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
  69. const char *first_choice, const char *second_choice);
  70. extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  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. MsgUpdate, //!< Short message even while printing from SD
  106. Resuming, //!< Resuming message
  107. };
  108. extern CustomMsg custom_message_type;
  109. extern unsigned int custom_message_state;
  110. extern uint8_t farm_mode;
  111. extern int farm_timer;
  112. extern uint8_t farm_status;
  113. extern bool UserECoolEnabled();
  114. extern bool FarmOrUserECool();
  115. #ifdef TMC2130
  116. #define SILENT_MODE_NORMAL 0
  117. #define SILENT_MODE_STEALTH 1
  118. #define SILENT_MODE_OFF SILENT_MODE_NORMAL
  119. #else
  120. #define SILENT_MODE_POWER 0
  121. #define SILENT_MODE_SILENT 1
  122. #define SILENT_MODE_AUTO 2
  123. #define SILENT_MODE_OFF SILENT_MODE_POWER
  124. #endif
  125. #ifdef IR_SENSOR_ANALOG
  126. extern bool bMenuFSDetect;
  127. void printf_IRSensorAnalogBoardChange();
  128. #endif //IR_SENSOR_ANALOG
  129. extern int8_t SilentModeMenu;
  130. extern uint8_t SilentModeMenu_MMU;
  131. extern bool cancel_heatup;
  132. extern bool isPrintPaused;
  133. extern uint8_t scrollstuff;
  134. void lcd_ignore_click(bool b=true);
  135. void lcd_commands();
  136. extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function
  137. void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()")
  138. void change_extr(int extr);
  139. #ifdef SNMM
  140. void extr_unload_all();
  141. void extr_unload_used();
  142. #endif //SNMM
  143. void extr_unload();
  144. enum class FilamentAction : uint_least8_t
  145. {
  146. None, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
  147. Load,
  148. AutoLoad,
  149. UnLoad,
  150. MmuLoad,
  151. MmuUnLoad,
  152. MmuEject,
  153. MmuCut,
  154. Preheat,
  155. Lay1Cal,
  156. };
  157. extern FilamentAction eFilamentAction;
  158. extern bool bFilamentFirstRun;
  159. extern bool bFilamentPreheatState;
  160. extern bool bFilamentAction;
  161. void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
  162. void mFilamentItemForce();
  163. void lcd_generic_preheat_menu();
  164. void unload_filament(bool automatic = false);
  165. void stack_error();
  166. void lcd_printer_connected();
  167. void lcd_ping();
  168. void lcd_calibrate_extruder();
  169. void lcd_farm_sdcard_menu();
  170. //void getFileDescription(char *name, char *description);
  171. void lcd_farm_sdcard_menu_w();
  172. //void get_description();
  173. void lcd_wait_for_heater();
  174. void lcd_wait_for_cool_down();
  175. void lcd_move_e(); // NOT static due to usage in Marlin_main
  176. void lcd_extr_cal_reset();
  177. void lcd_temp_cal_show_result(bool result);
  178. #ifdef PINDA_THERMISTOR
  179. bool lcd_wait_for_pinda(float temp);
  180. #endif //PINDA_THERMISTOR
  181. void bowden_menu();
  182. char reset_menu();
  183. uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
  184. void lcd_pinda_calibration_menu();
  185. void lcd_calibrate_pinda();
  186. void lcd_temp_calibration_set();
  187. void display_loading();
  188. void lcd_set_degree();
  189. #if (LANG_MODE != 0)
  190. void lcd_language();
  191. #endif
  192. void lcd_wizard();
  193. bool lcd_autoDepleteEnabled();
  194. //! @brief Wizard state
  195. enum class WizState : uint8_t
  196. {
  197. Run, //!< run wizard? Main entry point.
  198. Restore, //!< restore calibration status
  199. Selftest, //!< self test
  200. Xyz, //!< xyz calibration
  201. Z, //!< z calibration
  202. IsFil, //!< Is filament loaded? First step of 1st layer calibration
  203. PreheatPla, //!< waiting for preheat nozzle for PLA
  204. Preheat, //!< Preheat for any material
  205. LoadFilCold, //!< Load filament for MMU
  206. LoadFilHot, //!< Load filament without MMU
  207. IsPla, //!< Is PLA filament?
  208. Lay1CalCold, //!< First layer calibration, temperature not selected yet
  209. Lay1CalHot, //!< First layer calibration, temperature already selected
  210. RepeatLay1Cal, //!< Repeat first layer calibration?
  211. Finish, //!< Deactivate wizard
  212. };
  213. void lcd_wizard(WizState state);
  214. extern void lcd_experimental_toggle();
  215. extern void lcd_experimental_menu();
  216. #ifdef PINDA_TEMP_COMP
  217. extern void lcd_pinda_temp_compensation_toggle();
  218. #endif //PINDA_TEMP_COMP
  219. #endif //ULTRALCD_H