ultralcd.h 4.9 KB

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