ultralcd.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "Marlin.h"
  4. #ifdef ULTRA_LCD
  5. void lcd_update();
  6. // Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
  7. void lcd_update_enable(bool enable);
  8. void lcd_init();
  9. void lcd_setstatus(const char* message);
  10. void lcd_setstatuspgm(const char* message);
  11. void lcd_setalertstatuspgm(const char* message);
  12. void lcd_reset_alert_level();
  13. void lcd_adjust_z();
  14. void lcd_pick_babystep();
  15. void lcd_alright();
  16. void EEPROM_save_B(int pos, int* value);
  17. void EEPROM_read_B(int pos, int* value);
  18. void lcd_wait_interact();
  19. void lcd_change_filament();
  20. void lcd_loading_filament();
  21. void lcd_change_success();
  22. void lcd_loading_color();
  23. void lcd_force_language_selection();
  24. void lcd_sdcard_stop();
  25. bool lcd_detected(void);
  26. static void lcd_selftest();
  27. static bool lcd_selfcheck_endstops();
  28. static bool lcd_selfcheck_axis(int _axis, int _travel);
  29. static bool lcd_selfcheck_check_heater(bool _isbed);
  30. static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay);
  31. static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
  32. static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
  33. static void lcd_menu_statistics();
  34. extern bool lcd_calibrate_z_end_stop_manual();
  35. extern void lcd_diag_show_end_stops();
  36. #ifdef DOGLCD
  37. extern int lcd_contrast;
  38. void lcd_setcontrast(uint8_t value);
  39. #endif
  40. static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
  41. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  42. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  43. #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
  44. #define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
  45. #define LCD_UPDATE_INTERVAL 100
  46. #define LCD_TIMEOUT_TO_STATUS 15000
  47. #ifdef ULTIPANEL
  48. void lcd_buttons_update();
  49. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  50. #ifdef REPRAPWORLD_KEYPAD
  51. extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
  52. #endif
  53. #else
  54. FORCE_INLINE void lcd_buttons_update() {}
  55. #endif
  56. extern int plaPreheatHotendTemp;
  57. extern int plaPreheatHPBTemp;
  58. extern int plaPreheatFanSpeed;
  59. extern int absPreheatHotendTemp;
  60. extern int absPreheatHPBTemp;
  61. extern int absPreheatFanSpeed;
  62. extern bool cancel_heatup;
  63. #ifdef FILAMENT_LCD_DISPLAY
  64. extern unsigned long message_millis;
  65. #endif
  66. void lcd_buzz(long duration,uint16_t freq);
  67. bool lcd_clicked();
  68. void lcd_ignore_click(bool b=true);
  69. void lcd_commands();
  70. #ifdef NEWPANEL
  71. #define EN_C (1<<BLEN_C)
  72. #define EN_B (1<<BLEN_B)
  73. #define EN_A (1<<BLEN_A)
  74. #define LCD_CLICKED (buttons&EN_C)
  75. #ifdef REPRAPWORLD_KEYPAD
  76. #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
  77. #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
  78. #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
  79. #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
  80. #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
  81. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
  82. #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
  83. #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
  84. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  85. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
  86. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
  87. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
  88. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
  89. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
  90. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
  91. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
  92. #endif //REPRAPWORLD_KEYPAD
  93. #else
  94. //atomic, do not change
  95. #define B_LE (1<<BL_LE)
  96. #define B_UP (1<<BL_UP)
  97. #define B_MI (1<<BL_MI)
  98. #define B_DW (1<<BL_DW)
  99. #define B_RI (1<<BL_RI)
  100. #define B_ST (1<<BL_ST)
  101. #define EN_B (1<<BLEN_B)
  102. #define EN_A (1<<BLEN_A)
  103. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  104. #endif//NEWPANEL
  105. #else //no LCD
  106. FORCE_INLINE void
  107. {}
  108. FORCE_INLINE void lcd_init() {}
  109. FORCE_INLINE void lcd_setstatus(const char* message) {}
  110. FORCE_INLINE void lcd_buttons_update() {}
  111. FORCE_INLINE void lcd_reset_alert_level() {}
  112. FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
  113. FORCE_INLINE bool lcd_detected(void) { return true; }
  114. #define LCD_MESSAGEPGM(x)
  115. #define LCD_ALERTMESSAGEPGM(x)
  116. #endif //ULTRA_LCD
  117. char *itostr2(const uint8_t &x);
  118. char *itostr31(const int &xx);
  119. char *itostr3(const int &xx);
  120. char *itostr3left(const int &xx);
  121. char *itostr4(const int &xx);
  122. char *ftostr3(const float &x);
  123. char *ftostr31ns(const float &x); // float to string without sign character
  124. char *ftostr31(const float &x);
  125. char *ftostr32(const float &x);
  126. char *ftostr32ns(const float &x);
  127. char *ftostr43(const float &x);
  128. char *ftostr12ns(const float &x);
  129. char *ftostr13ns(const float &x);
  130. char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
  131. char *ftostr5(const float &x);
  132. char *ftostr51(const float &x);
  133. char *ftostr52(const float &x);
  134. extern void lcd_implementation_clear();
  135. extern void lcd_printPGM(const char* str);
  136. extern void lcd_print_at_PGM(uint8_t x, uint8_t y, const char* str);
  137. extern void lcd_implementation_print(const char *str);
  138. extern void lcd_implementation_print(int8_t i);
  139. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int8_t i);
  140. extern void lcd_implementation_print(int i);
  141. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, int i);
  142. extern void lcd_implementation_print(float f);
  143. extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str);
  144. #endif //ULTRALCD_H