ultralcd.h 4.3 KB

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