ultralcd.h 5.4 KB

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