Reduce code for invariant lcd_detected

This commit is contained in:
Scott Lahteine 2016-11-03 18:03:02 -05:00
parent b23d255491
commit cad792e702
2 changed files with 10 additions and 9 deletions

View file

@ -2982,13 +2982,9 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
lastEncoderBits = enc; lastEncoderBits = enc;
} }
bool lcd_detected(void) { #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
#if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE) bool lcd_detected() { return lcd.LcdDetected() == 1; }
return lcd.LcdDetected() == 1; #endif
#else
return true;
#endif
}
#endif // ULTIPANEL #endif // ULTIPANEL

View file

@ -41,10 +41,15 @@
void lcd_setstatuspgm(const char* message, const uint8_t level=0); void lcd_setstatuspgm(const char* message, const uint8_t level=0);
void lcd_setalertstatuspgm(const char* message); void lcd_setalertstatuspgm(const char* message);
void lcd_reset_alert_level(); void lcd_reset_alert_level();
bool lcd_detected(void);
void lcd_kill_screen(); void lcd_kill_screen();
void kill_screen(const char* lcd_msg); void kill_screen(const char* lcd_msg);
#if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
bool lcd_detected();
#else
inline bool lcd_detected() { return true; }
#endif
#if HAS_BUZZER #if HAS_BUZZER
void lcd_buzz(long duration, uint16_t freq); void lcd_buzz(long duration, uint16_t freq);
#endif #endif
@ -155,7 +160,7 @@
inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); } inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
inline void lcd_buttons_update() {} inline void lcd_buttons_update() {}
inline void lcd_reset_alert_level() {} inline void lcd_reset_alert_level() {}
inline bool lcd_detected(void) { return true; } inline bool lcd_detected() { return true; }
#define LCD_MESSAGEPGM(x) NOOP #define LCD_MESSAGEPGM(x) NOOP
#define LCD_ALERTMESSAGEPGM(x) NOOP #define LCD_ALERTMESSAGEPGM(x) NOOP