Browse Source

Reduce code for invariant lcd_detected

Scott Lahteine 8 years ago
parent
commit
cad792e702
2 changed files with 10 additions and 9 deletions
  1. 3
    7
      Marlin/ultralcd.cpp
  2. 7
    2
      Marlin/ultralcd.h

+ 3
- 7
Marlin/ultralcd.cpp View File

@@ -2982,13 +2982,9 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2982 2982
     lastEncoderBits = enc;
2983 2983
   }
2984 2984
 
2985
-  bool lcd_detected(void) {
2986
-    #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
2987
-      return lcd.LcdDetected() == 1;
2988
-    #else
2989
-      return true;
2990
-    #endif
2991
-  }
2985
+  #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
2986
+    bool lcd_detected() { return lcd.LcdDetected() == 1; }
2987
+  #endif
2992 2988
 
2993 2989
 #endif // ULTIPANEL
2994 2990
 

+ 7
- 2
Marlin/ultralcd.h View File

@@ -41,10 +41,15 @@
41 41
   void lcd_setstatuspgm(const char* message, const uint8_t level=0);
42 42
   void lcd_setalertstatuspgm(const char* message);
43 43
   void lcd_reset_alert_level();
44
-  bool lcd_detected(void);
45 44
   void lcd_kill_screen();
46 45
   void kill_screen(const char* lcd_msg);
47 46
 
47
+  #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
48
+    bool lcd_detected();
49
+  #else
50
+    inline bool lcd_detected() { return true; }
51
+  #endif
52
+
48 53
   #if HAS_BUZZER
49 54
     void lcd_buzz(long duration, uint16_t freq);
50 55
   #endif
@@ -155,7 +160,7 @@
155 160
   inline void lcd_setstatuspgm(const char* message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
156 161
   inline void lcd_buttons_update() {}
157 162
   inline void lcd_reset_alert_level() {}
158
-  inline bool lcd_detected(void) { return true; }
163
+  inline bool lcd_detected() { return true; }
159 164
 
160 165
   #define LCD_MESSAGEPGM(x) NOOP
161 166
   #define LCD_ALERTMESSAGEPGM(x) NOOP

Loading…
Cancel
Save