Browse Source

Reduce code for invariant lcd_detected

pull/1/head
Scott Lahteine 8 years ago
parent
commit
cad792e702
  1. 6
      Marlin/ultralcd.cpp
  2. 9
      Marlin/ultralcd.h

6
Marlin/ultralcd.cpp

@ -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)
return lcd.LcdDetected() == 1; bool lcd_detected() { return lcd.LcdDetected() == 1; }
#else
return true;
#endif #endif
}
#endif // ULTIPANEL #endif // ULTIPANEL

9
Marlin/ultralcd.h

@ -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

Loading…
Cancel
Save