ultralcd.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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);
  27. void lcd_confirm_print();
  28. void lcd_mylang();
  29. bool lcd_detected(void);
  30. static void lcd_selftest();
  31. static bool lcd_selfcheck_endstops();
  32. static bool lcd_selfcheck_axis(int _axis, int _travel);
  33. static bool lcd_selfcheck_check_heater(bool _isbed);
  34. static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay);
  35. static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
  36. static bool lcd_selftest_fan_dialog(int _fan);
  37. static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
  38. void lcd_menu_statistics();
  39. static bool lcd_selfcheck_pulleys(int axis);
  40. extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
  41. inline const char* lcd_display_message_fullscreen_P(const char *msg)
  42. { uint8_t nlines; return lcd_display_message_fullscreen_P(msg, nlines); }
  43. extern void lcd_wait_for_click();
  44. extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
  45. // 0: no, 1: yes, -1: timeouted
  46. extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
  47. // Ask the user to move the Z axis up to the end stoppers and let
  48. // the user confirm that it has been done.
  49. extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
  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. static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
  58. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  59. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  60. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  61. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  62. #define LCD_UPDATE_INTERVAL 100
  63. #define LCD_TIMEOUT_TO_STATUS 15000
  64. #ifdef ULTIPANEL
  65. void lcd_buttons_update();
  66. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  67. #ifdef REPRAPWORLD_KEYPAD
  68. extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
  69. #endif
  70. #else
  71. FORCE_INLINE void lcd_buttons_update() {}
  72. #endif
  73. // To be used in lcd_commands_type.
  74. #define LCD_COMMAND_IDLE 0
  75. #define LCD_COMMAND_LOAD_FILAMENT 1
  76. #define LCD_COMMAND_STOP_PRINT 2
  77. #define LCD_COMMAND_FARM_MODE_CONFIRM 4
  78. #define LCD_COMMAND_LONG_PAUSE 5
  79. #define LCD_COMMAND_LONG_PAUSE_RESUME 6
  80. #define LCD_COMMAND_PID_EXTRUDER 7
  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 SNMM
  88. extern uint8_t snmm_extruder;
  89. #endif // SNMM
  90. extern bool cancel_heatup;
  91. extern bool isPrintPaused;
  92. #ifdef FILAMENT_LCD_DISPLAY
  93. extern unsigned long message_millis;
  94. #endif
  95. void lcd_buzz(long duration,uint16_t freq);
  96. bool lcd_clicked();
  97. void lcd_ignore_click(bool b=true);
  98. void lcd_commands();
  99. #ifdef NEWPANEL
  100. #define EN_C (1<<BLEN_C)
  101. #define EN_B (1<<BLEN_B)
  102. #define EN_A (1<<BLEN_A)
  103. #define LCD_CLICKED (buttons&EN_C)
  104. #ifdef REPRAPWORLD_KEYPAD
  105. #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
  106. #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
  107. #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
  108. #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
  109. #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
  110. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
  111. #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
  112. #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
  113. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  114. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
  115. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
  116. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
  117. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
  118. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
  119. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
  120. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
  121. #endif //REPRAPWORLD_KEYPAD
  122. #else
  123. //atomic, do not change
  124. #define B_LE (1<<BL_LE)
  125. #define B_UP (1<<BL_UP)
  126. #define B_MI (1<<BL_MI)
  127. #define B_DW (1<<BL_DW)
  128. #define B_RI (1<<BL_RI)
  129. #define B_ST (1<<BL_ST)
  130. #define EN_B (1<<BLEN_B)
  131. #define EN_A (1<<BLEN_A)
  132. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  133. #endif//NEWPANEL
  134. #else //no LCD
  135. FORCE_INLINE void
  136. {}
  137. FORCE_INLINE void lcd_init() {}
  138. FORCE_INLINE void lcd_setstatus(const char* message) {}
  139. FORCE_INLINE void lcd_buttons_update() {}
  140. FORCE_INLINE void lcd_reset_alert_level() {}
  141. FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
  142. FORCE_INLINE bool lcd_detected(void) { return true; }
  143. #define LCD_MESSAGEPGM(x)
  144. #define LCD_ALERTMESSAGEPGM(x)
  145. #endif //ULTRA_LCD
  146. char *itostr2(const uint8_t &x);
  147. char *itostr31(const int &xx);
  148. char *itostr3(const int &xx);
  149. char *itostr3left(const int &xx);
  150. char *itostr4(const int &xx);
  151. char *ftostr3(const float &x);
  152. char *ftostr31ns(const float &x); // float to string without sign character
  153. char *ftostr31(const float &x);
  154. char *ftostr32(const float &x);
  155. char *ftostr32ns(const float &x);
  156. char *ftostr43(const float &x);
  157. char *ftostr12ns(const float &x);
  158. char *ftostr13ns(const float &x);
  159. char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
  160. char *ftostr5(const float &x);
  161. char *ftostr51(const float &x);
  162. char *ftostr52(const float &x);
  163. extern void lcd_implementation_clear();
  164. extern void lcd_printPGM(const char* str);
  165. extern void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str);
  166. extern void lcd_implementation_write(char c);
  167. extern void lcd_implementation_print(const char *str);
  168. extern void lcd_implementation_print(int8_t i);
  169. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i);
  170. extern void lcd_implementation_print(int i);
  171. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int i);
  172. extern void lcd_implementation_print(float f);
  173. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
  174. void change_extr(int extr);
  175. static void lcd_colorprint_change();
  176. static int get_ext_nr();
  177. static void extr_adj(int extruder);
  178. static void extr_adj_0();
  179. static void extr_adj_1();
  180. static void extr_adj_2();
  181. static void extr_adj_3();
  182. static void fil_load_menu();
  183. static void fil_unload_menu();
  184. static void extr_unload_0();
  185. static void extr_unload_1();
  186. static void extr_unload_2();
  187. static void extr_unload_3();
  188. static void lcd_disable_farm_mode();
  189. void extr_unload_all();
  190. void extr_unload_used();
  191. void extr_unload();
  192. static char snmm_stop_print_menu();
  193. void stack_error();
  194. static void lcd_ping_allert();
  195. void lcd_printer_connected();
  196. void lcd_ping();
  197. void lcd_calibrate_extruder();
  198. void lcd_farm_sdcard_menu();
  199. //void getFileDescription(char *name, char *description);
  200. void lcd_farm_sdcard_menu_w();
  201. //void get_description();
  202. void lcd_wait_for_cool_down();
  203. void adjust_bed_reset();
  204. void lcd_extr_cal_reset();
  205. union MenuData;
  206. void bowden_menu();
  207. char reset_menu();
  208. char choose_extruder_menu();
  209. void lcd_pinda_calibration_menu();
  210. void lcd_calibrate_pinda();
  211. void lcd_temp_calibration_set();
  212. void display_loading();
  213. void lcd_service_mode_show_result();
  214. #endif //ULTRALCD_H