ultralcd.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "Marlin.h"
  4. #include "mesh_bed_calibration.h"
  5. extern int lcd_puts_P(const char* str);
  6. extern int lcd_printf_P(const char* format, ...);
  7. #ifdef ULTRA_LCD
  8. void lcd_update(uint8_t lcdDrawUpdateOverride = 0, bool forceRedraw = false);
  9. // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
  10. void lcd_update_enable(bool enable);
  11. void lcd_init();
  12. void lcd_setstatus(const char* message);
  13. void lcd_setstatuspgm(const char* message);
  14. void lcd_setalertstatuspgm(const char* message);
  15. void lcd_reset_alert_level();
  16. uint8_t get_message_level();
  17. void lcd_adjust_z();
  18. void lcd_pick_babystep();
  19. void lcd_alright();
  20. void EEPROM_save_B(int pos, int* value);
  21. void EEPROM_read_B(int pos, int* value);
  22. void lcd_wait_interact();
  23. void lcd_change_filament();
  24. void lcd_loading_filament();
  25. void lcd_change_success();
  26. void lcd_loading_color();
  27. void lcd_sdcard_stop();
  28. void lcd_sdcard_pause();
  29. void lcd_print_stop();
  30. void prusa_statistics(int _message, uint8_t _col_nr = 0);
  31. void lcd_confirm_print();
  32. unsigned char lcd_choose_color();
  33. //void lcd_mylang();
  34. bool lcd_detected(void);
  35. extern bool lcd_selftest();
  36. void lcd_menu_statistics();
  37. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  38. inline const char* lcd_display_message_fullscreen_P(const char *msg)
  39. { uint8_t nlines; return lcd_display_message_fullscreen_P(msg, nlines); }
  40. extern void lcd_wait_for_click();
  41. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  42. // 0: no, 1: yes, -1: timeouted
  43. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  44. extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  45. // Ask the user to move the Z axis up to the end stoppers and let
  46. // the user confirm that it has been done.
  47. #ifndef TMC2130
  48. extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
  49. #endif
  50. // Show the result of the calibration process on the LCD screen.
  51. extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
  52. extern void lcd_diag_show_end_stops();
  53. #ifdef DOGLCD
  54. extern int lcd_contrast;
  55. void lcd_setcontrast(uint8_t value);
  56. #endif
  57. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  58. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  59. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  60. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  61. #define LCD_UPDATE_INTERVAL 100
  62. #define LCD_TIMEOUT_TO_STATUS 30000
  63. #ifdef ULTIPANEL
  64. void lcd_buttons_update();
  65. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  66. #ifdef REPRAPWORLD_KEYPAD
  67. extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
  68. #endif
  69. #else
  70. FORCE_INLINE void lcd_buttons_update() {}
  71. #endif
  72. // To be used in lcd_commands_type.
  73. #define LCD_COMMAND_IDLE 0
  74. #define LCD_COMMAND_LOAD_FILAMENT 1
  75. #define LCD_COMMAND_STOP_PRINT 2
  76. #define LCD_COMMAND_FARM_MODE_CONFIRM 4
  77. #define LCD_COMMAND_LONG_PAUSE 5
  78. #define LCD_COMMAND_LONG_PAUSE_RESUME 6
  79. #define LCD_COMMAND_PID_EXTRUDER 7
  80. #define LCD_COMMAND_V2_CAL 8
  81. extern unsigned long lcd_timeoutToStatus;
  82. extern int lcd_commands_type;
  83. extern uint8_t farm_mode;
  84. extern int farm_no;
  85. extern int farm_timer;
  86. extern int farm_status;
  87. #ifdef TMC2130
  88. #define SILENT_MODE_NORMAL 0
  89. #define SILENT_MODE_STEALTH 1
  90. #define SILENT_MODE_OFF SILENT_MODE_NORMAL
  91. #else
  92. #define SILENT_MODE_POWER 0
  93. #define SILENT_MODE_SILENT 1
  94. #define SILENT_MODE_AUTO 2
  95. #define SILENT_MODE_OFF SILENT_MODE_POWER
  96. #endif
  97. extern int8_t SilentModeMenu;
  98. #ifdef SNMM
  99. extern uint8_t snmm_extruder;
  100. #endif // SNMM
  101. extern bool cancel_heatup;
  102. extern bool isPrintPaused;
  103. #ifdef FILAMENT_LCD_DISPLAY
  104. extern unsigned long message_millis;
  105. #endif
  106. void lcd_buzz(long duration,uint16_t freq);
  107. bool lcd_clicked();
  108. void lcd_ignore_click(bool b=true);
  109. void lcd_commands();
  110. #ifdef NEWPANEL
  111. #define EN_C (1<<BLEN_C)
  112. #define EN_B (1<<BLEN_B)
  113. #define EN_A (1<<BLEN_A)
  114. #define LCD_CLICKED (buttons&EN_C)
  115. #ifdef REPRAPWORLD_KEYPAD
  116. #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
  117. #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
  118. #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
  119. #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
  120. #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
  121. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
  122. #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
  123. #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
  124. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  125. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
  126. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
  127. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
  128. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
  129. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
  130. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
  131. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
  132. #endif //REPRAPWORLD_KEYPAD
  133. #else
  134. //atomic, do not change
  135. #define B_LE (1<<BL_LE)
  136. #define B_UP (1<<BL_UP)
  137. #define B_MI (1<<BL_MI)
  138. #define B_DW (1<<BL_DW)
  139. #define B_RI (1<<BL_RI)
  140. #define B_ST (1<<BL_ST)
  141. #define EN_B (1<<BLEN_B)
  142. #define EN_A (1<<BLEN_A)
  143. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  144. #endif//NEWPANEL
  145. #else //no LCD
  146. FORCE_INLINE void
  147. {}
  148. FORCE_INLINE void lcd_init() {}
  149. FORCE_INLINE void lcd_setstatus(const char* message) {}
  150. FORCE_INLINE void lcd_buttons_update() {}
  151. FORCE_INLINE void lcd_reset_alert_level() {}
  152. FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
  153. FORCE_INLINE bool lcd_detected(void) { return true; }
  154. #define LCD_MESSAGEPGM(x)
  155. #define LCD_ALERTMESSAGEPGM(x)
  156. #endif //ULTRA_LCD
  157. char *itostr2(const uint8_t &x);
  158. char *itostr31(const int &xx);
  159. char *itostr3(const int &xx);
  160. char *itostr3left(const int &xx);
  161. char *itostr4(const int &xx);
  162. char *ftostr3(const float &x);
  163. char *ftostr31ns(const float &x); // float to string without sign character
  164. char *ftostr31(const float &x);
  165. char *ftostr32(const float &x);
  166. char *ftostr32ns(const float &x);
  167. char *ftostr43(const float &x, uint8_t offset = 0);
  168. char *ftostr12ns(const float &x);
  169. char *ftostr13ns(const float &x);
  170. char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
  171. char *ftostr5(const float &x);
  172. char *ftostr51(const float &x);
  173. char *ftostr52(const float &x);
  174. extern void lcd_implementation_clear();
  175. extern void lcd_printPGM(const char* str);
  176. extern void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str);
  177. extern void lcd_implementation_write(char c);
  178. extern void lcd_implementation_print(const char *str);
  179. extern void lcd_implementation_print(int8_t i);
  180. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i);
  181. extern void lcd_implementation_print(int i);
  182. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int i);
  183. extern void lcd_implementation_print(float f);
  184. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
  185. void change_extr(int extr);
  186. void extr_adj(int extruder);
  187. void extr_unload_all();
  188. void extr_unload_used();
  189. void extr_unload();
  190. void stack_error();
  191. void lcd_printer_connected();
  192. void lcd_ping();
  193. void lcd_calibrate_extruder();
  194. void lcd_farm_sdcard_menu();
  195. //void getFileDescription(char *name, char *description);
  196. void lcd_farm_sdcard_menu_w();
  197. //void get_description();
  198. void lcd_wait_for_heater();
  199. void lcd_wait_for_cool_down();
  200. void adjust_bed_reset();
  201. void lcd_extr_cal_reset();
  202. void lcd_temp_cal_show_result(bool result);
  203. bool lcd_wait_for_pinda(float temp);
  204. union MenuData;
  205. void bowden_menu();
  206. char reset_menu();
  207. char choose_extruder_menu();
  208. void lcd_pinda_calibration_menu();
  209. void lcd_calibrate_pinda();
  210. void lcd_temp_calibration_set();
  211. void display_loading();
  212. #if !SDSORT_USES_RAM
  213. void lcd_set_degree();
  214. void lcd_set_progress();
  215. #endif
  216. void lcd_language();
  217. void lcd_wizard();
  218. void lcd_wizard(int state);
  219. #endif //ULTRALCD_H