Some cleanup in ultralcd.h

This commit is contained in:
Scott Lahteine 2016-10-27 02:12:54 -05:00
parent 50ee749082
commit 1226ae1912

View File

@ -30,6 +30,13 @@
#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
extern int preheatHotendTemp1,
preheatBedTemp1,
preheatFanSpeed1,
preheatHotendTemp2,
preheatBedTemp2,
preheatFanSpeed2;
int lcd_strlen(const char* s);
int lcd_strlen_P(const char* s);
void lcd_update();
@ -65,32 +72,7 @@
#define LCD_TIMEOUT_TO_STATUS 15000
#if ENABLED(ULTIPANEL)
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
void lcd_buttons_update();
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
#if ENABLED(FILAMENT_CHANGE_FEATURE)
void lcd_filament_change_show_message(FilamentChangeMessage message);
#endif // FILAMENT_CHANGE_FEATURE
#else
FORCE_INLINE void lcd_buttons_update() {}
#endif
extern int preheatHotendTemp1,
preheatBedTemp1,
preheatFanSpeed1,
preheatHotendTemp2,
preheatBedTemp2,
preheatFanSpeed2;
#if ENABLED(FILAMENT_LCD_DISPLAY)
extern millis_t previous_lcd_status_ms;
#endif
bool lcd_blink();
#if ENABLED(ULTIPANEL)
#define BLEN_A 0
#define BLEN_B 1
// Encoder click is directly connected
@ -101,8 +83,27 @@
#define EN_A (_BV(BLEN_A))
#define EN_B (_BV(BLEN_B))
#define EN_C (_BV(BLEN_C))
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
void lcd_buttons_update();
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
#if ENABLED(FILAMENT_CHANGE_FEATURE)
void lcd_filament_change_show_message(FilamentChangeMessage message);
#endif // FILAMENT_CHANGE_FEATURE
#else
inline void lcd_buttons_update() {}
#endif
#if ENABLED(FILAMENT_LCD_DISPLAY)
extern millis_t previous_lcd_status_ms;
#endif
bool lcd_blink();
#if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
@ -153,14 +154,14 @@
#endif
#else //no LCD
FORCE_INLINE void lcd_update() {}
FORCE_INLINE void lcd_init() {}
FORCE_INLINE bool lcd_hasstatus() { return false; }
FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {UNUSED(message); UNUSED(persist);}
FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {UNUSED(message); UNUSED(level);}
FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE bool lcd_detected(void) { return true; }
inline void lcd_update() {}
inline void lcd_init() {}
inline bool lcd_hasstatus() { return false; }
inline void lcd_setstatus(const char* message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
inline void lcd_buttons_update() {}
inline void lcd_reset_alert_level() {}
inline bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x) NOOP
#define LCD_ALERTMESSAGEPGM(x) NOOP