ultralcd.h 8.1 KB

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