ultralcd.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. extern int lcd_puts_P(const char* str);
  8. extern int lcd_printf_P(const char* format, ...);
  9. extern void menu_lcd_longpress_func(void);
  10. extern void menu_lcd_charsetup_func(void);
  11. extern void menu_lcd_lcdupdate_func(void);
  12. struct EditMenuParentState
  13. {
  14. //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
  15. menu_func_t prevMenu;
  16. uint16_t prevEncoderPosition;
  17. //Variables used when editing values.
  18. const char* editLabel;
  19. void* editValue;
  20. int32_t minEditValue, maxEditValue;
  21. // menu_func_t callbackFunc;
  22. };
  23. union MenuData
  24. {
  25. struct BabyStep
  26. {
  27. // 29B total
  28. int8_t status;
  29. int babystepMem[3];
  30. float babystepMemMM[3];
  31. } babyStep;
  32. struct SupportMenu
  33. {
  34. // 6B+16B=22B total
  35. int8_t status;
  36. bool is_flash_air;
  37. uint8_t ip[4];
  38. char ip_str[3*4+3+1];
  39. } supportMenu;
  40. struct AdjustBed
  41. {
  42. // 6+13+16=35B
  43. // editMenuParentState is used when an edit menu is entered, so it knows
  44. // the return menu and encoder state.
  45. struct EditMenuParentState editMenuParentState;
  46. int8_t status;
  47. int8_t left;
  48. int8_t right;
  49. int8_t front;
  50. int8_t rear;
  51. int left2;
  52. int right2;
  53. int front2;
  54. int rear2;
  55. } adjustBed;
  56. struct TuneMenu
  57. {
  58. // editMenuParentState is used when an edit menu is entered, so it knows
  59. // the return menu and encoder state.
  60. struct EditMenuParentState editMenuParentState;
  61. // To recognize, whether the menu has been just initialized.
  62. int8_t status;
  63. // Backup of extrudemultiply, to recognize, that the value has been changed and
  64. // it needs to be applied.
  65. int16_t extrudemultiply;
  66. } tuneMenu;
  67. // editMenuParentState is used when an edit menu is entered, so it knows
  68. // the return menu and encoder state.
  69. struct EditMenuParentState editMenuParentState;
  70. struct AutoLoadFilamentMenu
  71. {
  72. //ShortTimer timer;
  73. char dummy;
  74. } autoLoadFilamentMenu;
  75. struct _Lcd_moveMenu
  76. {
  77. bool initialized;
  78. bool endstopsEnabledPrevious;
  79. } _lcd_moveMenu;
  80. struct sdcard_menu_t
  81. {
  82. uint8_t viewState;
  83. } sdcard_menu;
  84. menu_data_edit_t edit_menu;
  85. };
  86. // State of the currently active menu.
  87. // C Union manages sharing of the static memory by all the menus.
  88. extern union MenuData menuData;
  89. // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
  90. void ultralcd_init();
  91. void lcd_setstatus(const char* message);
  92. void lcd_setstatuspgm(const char* message);
  93. void lcd_setalertstatuspgm(const char* message);
  94. void lcd_reset_alert_level();
  95. uint8_t get_message_level();
  96. void lcd_adjust_z();
  97. void lcd_pick_babystep();
  98. void lcd_alright();
  99. void EEPROM_save_B(int pos, int* value);
  100. void EEPROM_read_B(int pos, int* value);
  101. void lcd_wait_interact();
  102. void lcd_change_filament();
  103. void lcd_loading_filament();
  104. void lcd_change_success();
  105. void lcd_loading_color();
  106. void lcd_sdcard_stop();
  107. void lcd_sdcard_pause();
  108. void lcd_print_stop();
  109. void prusa_statistics(int _message, uint8_t _col_nr = 0);
  110. void lcd_confirm_print();
  111. unsigned char lcd_choose_color();
  112. //void lcd_mylang();
  113. extern bool lcd_selftest();
  114. void lcd_menu_statistics();
  115. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  116. inline const char* lcd_display_message_fullscreen_P(const char *msg)
  117. { uint8_t nlines; return lcd_display_message_fullscreen_P(msg, nlines); }
  118. extern void lcd_wait_for_click();
  119. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  120. // 0: no, 1: yes, -1: timeouted
  121. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  122. extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  123. // Ask the user to move the Z axis up to the end stoppers and let
  124. // the user confirm that it has been done.
  125. #ifndef TMC2130
  126. extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
  127. #endif
  128. // Show the result of the calibration process on the LCD screen.
  129. extern void lcd_bed_calibration_show_result(uint8_t result, uint8_t point_too_far_mask);
  130. extern void lcd_diag_show_end_stops();
  131. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  132. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  133. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  134. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  135. // To be used in lcd_commands_type.
  136. #define LCD_COMMAND_IDLE 0
  137. #define LCD_COMMAND_LOAD_FILAMENT 1
  138. #define LCD_COMMAND_STOP_PRINT 2
  139. #define LCD_COMMAND_FARM_MODE_CONFIRM 4
  140. #define LCD_COMMAND_LONG_PAUSE 5
  141. #define LCD_COMMAND_LONG_PAUSE_RESUME 6
  142. #define LCD_COMMAND_PID_EXTRUDER 7
  143. #define LCD_COMMAND_V2_CAL 8
  144. extern int lcd_commands_type;
  145. extern uint8_t farm_mode;
  146. extern int farm_no;
  147. extern int farm_timer;
  148. extern int farm_status;
  149. #ifdef TMC2130
  150. #define SILENT_MODE_NORMAL 0
  151. #define SILENT_MODE_STEALTH 1
  152. #define SILENT_MODE_OFF SILENT_MODE_NORMAL
  153. #else
  154. #define SILENT_MODE_POWER 0
  155. #define SILENT_MODE_SILENT 1
  156. #define SILENT_MODE_AUTO 2
  157. #define SILENT_MODE_OFF SILENT_MODE_POWER
  158. #endif
  159. extern int8_t SilentModeMenu;
  160. #if defined (SNMM) || defined (SNMM_V2)
  161. extern uint8_t snmm_extruder;
  162. #endif // defined (SNMM) || defined (SNMM_V2)
  163. extern bool cancel_heatup;
  164. extern bool isPrintPaused;
  165. void lcd_ignore_click(bool b=true);
  166. void lcd_commands();
  167. void change_extr(int extr);
  168. void extr_adj(int extruder);
  169. void extr_unload_all();
  170. void extr_unload_used();
  171. void extr_unload();
  172. void unload_filament();
  173. void stack_error();
  174. void lcd_printer_connected();
  175. void lcd_ping();
  176. void lcd_calibrate_extruder();
  177. void lcd_farm_sdcard_menu();
  178. //void getFileDescription(char *name, char *description);
  179. void lcd_farm_sdcard_menu_w();
  180. //void get_description();
  181. void lcd_wait_for_heater();
  182. void lcd_wait_for_cool_down();
  183. void adjust_bed_reset();
  184. void lcd_extr_cal_reset();
  185. void lcd_temp_cal_show_result(bool result);
  186. bool lcd_wait_for_pinda(float temp);
  187. union MenuData;
  188. void bowden_menu();
  189. char reset_menu();
  190. char choose_extruder_menu();
  191. void lcd_pinda_calibration_menu();
  192. void lcd_calibrate_pinda();
  193. void lcd_temp_calibration_set();
  194. void display_loading();
  195. #if !SDSORT_USES_RAM
  196. void lcd_set_degree();
  197. void lcd_set_progress();
  198. #endif
  199. void lcd_language();
  200. void lcd_wizard();
  201. void lcd_wizard(int state);
  202. #endif //ULTRALCD_H