My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ultralcd.h 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef ULTRALCD_H
  2. #define ULTRALCD_H
  3. #include "Marlin.h"
  4. #if ENABLED(ULTRA_LCD)
  5. #include "buzzer.h"
  6. int lcd_strlen(char* s);
  7. int lcd_strlen_P(const char* s);
  8. void lcd_update();
  9. void lcd_init();
  10. bool lcd_hasstatus();
  11. void lcd_setstatus(const char* message, const bool persist=false);
  12. void lcd_setstatuspgm(const char* message, const uint8_t level=0);
  13. void lcd_setalertstatuspgm(const char* message);
  14. void lcd_reset_alert_level();
  15. bool lcd_detected(void);
  16. #if ENABLED(LCD_USE_I2C_BUZZER)
  17. void lcd_buzz(long duration, uint16_t freq);
  18. #endif
  19. #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
  20. void dontExpireStatus();
  21. #endif
  22. #if ENABLED(DOGLCD)
  23. extern int lcd_contrast;
  24. void lcd_setcontrast(uint8_t value);
  25. #endif
  26. #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
  27. #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
  28. #define LCD_UPDATE_INTERVAL 100
  29. #define LCD_TIMEOUT_TO_STATUS 15000
  30. #if ENABLED(ULTIPANEL)
  31. void lcd_buttons_update();
  32. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
  33. #if ENABLED(REPRAPWORLD_KEYPAD)
  34. extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
  35. #endif
  36. #else
  37. FORCE_INLINE void lcd_buttons_update() {}
  38. #endif
  39. extern int plaPreheatHotendTemp;
  40. extern int plaPreheatHPBTemp;
  41. extern int plaPreheatFanSpeed;
  42. extern int absPreheatHotendTemp;
  43. extern int absPreheatHPBTemp;
  44. extern int absPreheatFanSpeed;
  45. extern bool cancel_heatup;
  46. #if ENABLED(FILAMENT_LCD_DISPLAY)
  47. extern millis_t previous_lcd_status_ms;
  48. #endif
  49. void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
  50. bool lcd_clicked();
  51. void lcd_ignore_click(bool b=true);
  52. #if ENABLED(NEWPANEL)
  53. #define EN_C BIT(BLEN_C)
  54. #define EN_B BIT(BLEN_B)
  55. #define EN_A BIT(BLEN_A)
  56. #define LCD_CLICKED (buttons&EN_C)
  57. #if ENABLED(REPRAPWORLD_KEYPAD)
  58. #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
  59. #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
  60. #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))
  61. #define EN_REPRAPWORLD_KEYPAD_UP (BIT(BLEN_REPRAPWORLD_KEYPAD_UP))
  62. #define EN_REPRAPWORLD_KEYPAD_RIGHT (BIT(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
  63. #define EN_REPRAPWORLD_KEYPAD_MIDDLE (BIT(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
  64. #define EN_REPRAPWORLD_KEYPAD_DOWN (BIT(BLEN_REPRAPWORLD_KEYPAD_DOWN))
  65. #define EN_REPRAPWORLD_KEYPAD_LEFT (BIT(BLEN_REPRAPWORLD_KEYPAD_LEFT))
  66. #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
  67. #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
  68. #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
  69. #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
  70. #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
  71. #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
  72. #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
  73. #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
  74. #endif //REPRAPWORLD_KEYPAD
  75. #else
  76. //atomic, do not change
  77. #define B_LE BIT(BL_LE)
  78. #define B_UP BIT(BL_UP)
  79. #define B_MI BIT(BL_MI)
  80. #define B_DW BIT(BL_DW)
  81. #define B_RI BIT(BL_RI)
  82. #define B_ST BIT(BL_ST)
  83. #define EN_B BIT(BLEN_B)
  84. #define EN_A BIT(BLEN_A)
  85. #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
  86. #endif//NEWPANEL
  87. #else //no LCD
  88. FORCE_INLINE void lcd_update() {}
  89. FORCE_INLINE void lcd_init() {}
  90. FORCE_INLINE bool lcd_hasstatus() { return false; }
  91. FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {UNUSED(message); UNUSED(persist);}
  92. FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {UNUSED(message); UNUSED(level);}
  93. FORCE_INLINE void lcd_buttons_update() {}
  94. FORCE_INLINE void lcd_reset_alert_level() {}
  95. FORCE_INLINE bool lcd_detected(void) { return true; }
  96. #define LCD_MESSAGEPGM(x) do{}while(0)
  97. #define LCD_ALERTMESSAGEPGM(x) do{}while(0)
  98. #endif //ULTRA_LCD
  99. char* itostr2(const uint8_t& x);
  100. char* itostr31(const int& xx);
  101. char* itostr3(const int& xx);
  102. char* itostr3left(const int& xx);
  103. char* itostr4(const int& xx);
  104. char* itostr4sign(const int& x);
  105. char* ftostr3(const float& x);
  106. char* ftostr4sign(const float& x);
  107. char* ftostr31ns(const float& x); // float to string without sign character
  108. char* ftostr31(const float& x);
  109. char* ftostr32(const float& x);
  110. char* ftostr43(const float& x);
  111. char* ftostr12ns(const float& x);
  112. char* ftostr32sp(const float& x); // remove zero-padding from ftostr32
  113. char* ftostr5(const float& x);
  114. char* ftostr51(const float& x);
  115. char* ftostr52(const float& x);
  116. #endif //ULTRALCD_H