ultralcd.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. extern int lcd_puts_P(const char* str);
  9. extern int lcd_printf_P(const char* format, ...);
  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_setalertstatuspgm(const char* message);
  23. //! only update the alert message on the main status screen
  24. //! has no sideeffects, may be called multiple times
  25. void lcd_updatestatuspgm(const char *message);
  26. void lcd_reset_alert_level();
  27. uint8_t get_message_level();
  28. void lcd_adjust_z();
  29. void lcd_pick_babystep();
  30. void lcd_alright();
  31. void show_preheat_nozzle_warning();
  32. void EEPROM_save_B(int pos, int* value);
  33. void EEPROM_read_B(int pos, int* value);
  34. void lcd_wait_interact();
  35. void lcd_loading_filament();
  36. void lcd_change_success();
  37. void lcd_loading_color();
  38. void lcd_sdcard_stop();
  39. void lcd_pause_print();
  40. void lcd_resume_print();
  41. void lcd_print_stop();
  42. void prusa_statistics(int _message, uint8_t _col_nr = 0);
  43. void lcd_confirm_print();
  44. unsigned char lcd_choose_color();
  45. void lcd_load_filament_color_check();
  46. //void lcd_mylang();
  47. extern bool lcd_selftest();
  48. void lcd_menu_statistics();
  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. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  52. extern const char* lcd_display_message_fullscreen_P(const char *msg);
  53. extern void lcd_return_to_status();
  54. extern void lcd_wait_for_click();
  55. extern bool lcd_wait_for_click_delay(uint16_t nDelay);
  56. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  57. // 0: no, 1: yes, -1: timeouted
  58. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  59. extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
  60. const char *first_choice, const char *second_choice);
  61. extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  62. // Ask the user to move the Z axis up to the end stoppers and let
  63. // the user confirm that it has been done.
  64. #ifndef TMC2130
  65. extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
  66. #endif
  67. // Show the result of the calibration process on the LCD screen.
  68. extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
  69. extern void lcd_diag_show_end_stops();
  70. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  71. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  72. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  73. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  74. // To be used in lcd_commands_type.
  75. enum class LcdCommands : uint_least8_t
  76. {
  77. Idle,
  78. LoadFilament,
  79. StopPrint,
  80. FarmModeConfirm,
  81. LongPause,
  82. PidExtruder,
  83. Layer1Cal,
  84. };
  85. extern LcdCommands lcd_commands_type;
  86. extern int8_t FSensorStateMenu;
  87. enum class CustomMsg : uint_least8_t
  88. {
  89. Status, //!< status message from lcd_status_message variable
  90. MeshBedLeveling, //!< Mesh bed leveling in progress
  91. FilamentLoading, //!< Loading filament in progress
  92. PidCal, //!< PID tuning in progress
  93. TempCal, //!< PINDA temperature calibration
  94. TempCompPreheat, //!< Temperature compensation preheat
  95. };
  96. extern CustomMsg custom_message_type;
  97. extern unsigned int custom_message_state;
  98. extern uint8_t farm_mode;
  99. extern int farm_no;
  100. extern int farm_timer;
  101. extern uint8_t farm_status;
  102. #ifdef TMC2130
  103. #define SILENT_MODE_NORMAL 0
  104. #define SILENT_MODE_STEALTH 1
  105. #define SILENT_MODE_OFF SILENT_MODE_NORMAL
  106. #else
  107. #define SILENT_MODE_POWER 0
  108. #define SILENT_MODE_SILENT 1
  109. #define SILENT_MODE_AUTO 2
  110. #define SILENT_MODE_OFF SILENT_MODE_POWER
  111. #endif
  112. extern int8_t SilentModeMenu;
  113. extern uint8_t SilentModeMenu_MMU;
  114. extern bool cancel_heatup;
  115. extern bool isPrintPaused;
  116. void lcd_ignore_click(bool b=true);
  117. void lcd_commands();
  118. void change_extr(int extr);
  119. #ifdef SNMM
  120. void extr_unload_all();
  121. void extr_unload_used();
  122. #endif //SNMM
  123. void extr_unload();
  124. enum class FilamentAction : uint_least8_t
  125. {
  126. None, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
  127. Load,
  128. AutoLoad,
  129. UnLoad,
  130. MmuLoad,
  131. MmuUnLoad,
  132. MmuEject,
  133. MmuCut,
  134. };
  135. extern FilamentAction eFilamentAction;
  136. extern bool bFilamentFirstRun;
  137. extern bool bFilamentPreheatState;
  138. extern bool bFilamentAction;
  139. void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
  140. void mFilamentItemForce();
  141. void mFilamentMenu();
  142. void unload_filament();
  143. void stack_error();
  144. void lcd_printer_connected();
  145. void lcd_ping();
  146. void lcd_calibrate_extruder();
  147. void lcd_farm_sdcard_menu();
  148. //void getFileDescription(char *name, char *description);
  149. void lcd_farm_sdcard_menu_w();
  150. //void get_description();
  151. void lcd_wait_for_heater();
  152. void lcd_wait_for_cool_down();
  153. void lcd_extr_cal_reset();
  154. void lcd_temp_cal_show_result(bool result);
  155. bool lcd_wait_for_pinda(float temp);
  156. void bowden_menu();
  157. char reset_menu();
  158. uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
  159. void lcd_pinda_calibration_menu();
  160. void lcd_calibrate_pinda();
  161. void lcd_temp_calibration_set();
  162. void display_loading();
  163. #if !SDSORT_USES_RAM
  164. void lcd_set_degree();
  165. void lcd_set_progress();
  166. #endif
  167. void lcd_language();
  168. void lcd_wizard();
  169. bool lcd_autoDepleteEnabled();
  170. //! @brief Wizard state
  171. enum class WizState : uint8_t
  172. {
  173. Run, //!< run wizard? Entry point.
  174. Restore, //!< restore calibration status
  175. Selftest,
  176. Xyz, //!< xyz calibration
  177. Z, //!< z calibration
  178. IsFil, //!< Is filament loaded? Entry point for 1st layer calibration
  179. PreheatPla, //!< waiting for preheat nozzle for PLA
  180. Preheat, //!< Preheat for any material
  181. Unload, //!< Unload filament
  182. LoadFil, //!< Load filament
  183. IsPla, //!< Is PLA filament?
  184. Lay1Cal, //!< First layer calibration
  185. RepeatLay1Cal, //!< Repeat first layer calibration?
  186. Finish, //!< Deactivate wizard
  187. };
  188. void lcd_wizard(WizState state);
  189. #endif //ULTRALCD_H