ultralcd.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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();
  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. bool lcd_detected(void);
  27. static void lcd_selftest();
  28. static bool lcd_selfcheck_endstops();
  29. static bool lcd_selfcheck_axis(int _axis, int _travel);
  30. static bool lcd_selfcheck_check_heater(bool _isbed);
  31. static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay);
  32. static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
  33. static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
  34. static void lcd_menu_statistics();
  35. extern void lcd_display_message_fullscreen_P(const char *msg);
  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);
  40. // Ask the user to move the Z axis up to the end stoppers and let
  41. // the user confirm that it has been done.
  42. extern bool lcd_calibrate_z_end_stop_manual();
  43. // Show the result of the calibration process on the LCD screen.
  44. extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
  45. extern void lcd_diag_show_end_stops();
  46. #ifdef DOGLCD
  47. extern int lcd_contrast;
  48. void lcd_setcontrast(uint8_t value);
  49. #endif
  50. static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
  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 15000
  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. extern int plaPreheatHotendTemp;
  67. extern int plaPreheatHPBTemp;
  68. extern int plaPreheatFanSpeed;
  69. extern int absPreheatHotendTemp;
  70. extern int absPreheatHPBTemp;
  71. extern int absPreheatFanSpeed;
  72. extern bool cancel_heatup;
  73. #ifdef FILAMENT_LCD_DISPLAY
  74. extern unsigned long message_millis;
  75. #endif
  76. void lcd_buzz(long duration,uint16_t freq);
  77. bool lcd_clicked();
  78. void lcd_ignore_click(bool b=true);
  79. void lcd_commands();
  80. #ifdef NEWPANEL
  81. #define EN_C (1<<BLEN_C)
  82. #define EN_B (1<<BLEN_B)
  83. #define EN_A (1<<BLEN_A)
  84. #define LCD_CLICKED (buttons&EN_C)
  85. #ifdef REPRAPWORLD_KEYPAD
  86. #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
  87. #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
  88. #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
  89. #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
  90. #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
  91. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
  92. #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
  93. #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
  94. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  95. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
  96. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
  97. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
  98. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
  99. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
  100. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
  101. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
  102. #endif //REPRAPWORLD_KEYPAD
  103. #else
  104. //atomic, do not change
  105. #define B_LE (1<<BL_LE)
  106. #define B_UP (1<<BL_UP)
  107. #define B_MI (1<<BL_MI)
  108. #define B_DW (1<<BL_DW)
  109. #define B_RI (1<<BL_RI)
  110. #define B_ST (1<<BL_ST)
  111. #define EN_B (1<<BLEN_B)
  112. #define EN_A (1<<BLEN_A)
  113. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  114. #endif//NEWPANEL
  115. #else //no LCD
  116. FORCE_INLINE void
  117. {}
  118. FORCE_INLINE void lcd_init() {}
  119. FORCE_INLINE void lcd_setstatus(const char* message) {}
  120. FORCE_INLINE void lcd_buttons_update() {}
  121. FORCE_INLINE void lcd_reset_alert_level() {}
  122. FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
  123. FORCE_INLINE bool lcd_detected(void) { return true; }
  124. #define LCD_MESSAGEPGM(x)
  125. #define LCD_ALERTMESSAGEPGM(x)
  126. #endif //ULTRA_LCD
  127. char *itostr2(const uint8_t &x);
  128. char *itostr31(const int &xx);
  129. char *itostr3(const int &xx);
  130. char *itostr3left(const int &xx);
  131. char *itostr4(const int &xx);
  132. char *ftostr3(const float &x);
  133. char *ftostr31ns(const float &x); // float to string without sign character
  134. char *ftostr31(const float &x);
  135. char *ftostr32(const float &x);
  136. char *ftostr32ns(const float &x);
  137. char *ftostr43(const float &x);
  138. char *ftostr12ns(const float &x);
  139. char *ftostr13ns(const float &x);
  140. char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
  141. char *ftostr5(const float &x);
  142. char *ftostr51(const float &x);
  143. char *ftostr52(const float &x);
  144. extern void lcd_implementation_clear();
  145. extern void lcd_printPGM(const char* str);
  146. extern void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str);
  147. extern void lcd_implementation_write(char c);
  148. extern void lcd_implementation_print(const char *str);
  149. extern void lcd_implementation_print(int8_t i);
  150. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i);
  151. extern void lcd_implementation_print(int i);
  152. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int i);
  153. extern void lcd_implementation_print(float f);
  154. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
  155. #endif //ULTRALCD_H