소스 검색

Consolidate Malyan LCD and ExtUI

Scott Lahteine 6 년 전
부모
커밋
23ec650410
5개의 변경된 파일31개의 추가작업 그리고 55개의 파일을 삭제
  1. 1
    1
      Marlin/src/Marlin.cpp
  2. 6
    3
      Marlin/src/inc/Conditionals_LCD.h
  3. 14
    38
      Marlin/src/lcd/malyanlcd.cpp
  4. 3
    3
      Marlin/src/lcd/ultralcd.cpp
  5. 7
    10
      Marlin/src/lcd/ultralcd.h

+ 1
- 1
Marlin/src/Marlin.cpp 파일 보기

@@ -733,7 +733,7 @@ void kill(PGM_P const lcd_msg/*=NULL*/) {
733 733
 
734 734
   SERIAL_ERROR_MSG(MSG_ERR_KILLED);
735 735
 
736
-  #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
736
+  #if HAS_DISPLAY
737 737
     ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED));
738 738
   #else
739 739
     UNUSED(lcd_msg);

+ 6
- 3
Marlin/src/inc/Conditionals_LCD.h 파일 보기

@@ -329,8 +329,14 @@
329 329
   #define ULTRA_LCD
330 330
 #endif
331 331
 
332
+// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
333
+#if ENABLED(MALYAN_LCD)
334
+  #define EXTENSIBLE_UI
335
+#endif
336
+
332 337
 // Aliases for LCD features
333 338
 #define HAS_SPI_LCD          ENABLED(ULTRA_LCD)
339
+#define HAS_DISPLAY         (HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI))
334 340
 #define HAS_GRAPHICAL_LCD    ENABLED(DOGLCD)
335 341
 #define HAS_CHARACTER_LCD   (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
336 342
 #define HAS_LCD_MENU        (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
@@ -513,9 +519,6 @@
513 519
   #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
514 520
 #endif
515 521
 
516
-#if ENABLED(MALYAN_LCD)
517
-  #define EXTENSIBLE_UI
518
-#endif
519 522
 #define HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
520 523
 #define HAS_RESUME_CONTINUE   ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER)
521 524
 #define HAS_COLOR_LEDS        ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)

+ 14
- 38
Marlin/src/lcd/malyanlcd.cpp 파일 보기

@@ -474,52 +474,28 @@ namespace ExtUI {
474 474
     #endif
475 475
   }
476 476
 
477
-  void onPrinterKilled(PGM_P const msg) {}
477
+  void onStatusChanged(const char * const msg) {
478
+    write_to_lcd_P(PSTR("{E:"));
479
+    write_to_lcd(msg);
480
+    write_to_lcd_P("}");
481
+  }
482
+
483
+  // Not needed for Malyan LCD
484
+  void onPrinterKilled(PGM_P const msg) { UNUSED(msg); }
478 485
   void onMediaInserted() {};
479 486
   void onMediaError() {};
480 487
   void onMediaRemoved() {};
481
-  void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
488
+  void onPlayTone(const uint16_t frequency, const uint16_t duration) { UNUSED(frequency); UNUSED(duration); }
482 489
   void onPrintTimerStarted() {}
483 490
   void onPrintTimerPaused() {}
484 491
   void onPrintTimerStopped() {}
485 492
   void onFilamentRunout() {}
486
-  void onUserConfirmRequired(const char * const msg) {}
487
-  void onStatusChanged(const char * const msg) {
488
-    write_to_lcd_P(PSTR("{E:"));
489
-    write_to_lcd(msg);
490
-    write_to_lcd_P("}");
491
-  }
493
+  void onUserConfirmRequired(const char * const msg) { UNUSED(msg); }
492 494
   void onFactoryReset() {}
493
-
494
-  void onStoreSettings(char *buff) {
495
-    // This is called when saving to EEPROM (i.e. M500). If the ExtUI needs
496
-    // permanent data to be stored, it can write up to eeprom_data_size bytes
497
-    // into buff.
498
-
499
-    // Example:
500
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
501
-    //  memcpy(buff, &myDataStruct, sizeof(myDataStruct));
502
-  }
503
-
504
-  void onLoadSettings(const char *buff) {
505
-    // This is called while loading settings from EEPROM. If the ExtUI
506
-    // needs to retrieve data, it should copy up to eeprom_data_size bytes
507
-    // from buff
508
-
509
-    // Example:
510
-    //  static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
511
-    //  memcpy(&myDataStruct, buff, sizeof(myDataStruct));
512
-  }
513
-
514
-  void onConfigurationStoreWritten(bool success) {
515
-    // This is called after the entire EEPROM has been written,
516
-    // whether successful or not.
517
-  }
518
-
519
-  void onConfigurationStoreRead(bool success) {
520
-    // This is called after the entire EEPROM has been read,
521
-    // whether successful or not.
522
-  }
495
+  void onStoreSettings(char *buff) { UNUSED(buff); }
496
+  void onLoadSettings(const char *buff) { UNUSED(buff); }
497
+  void onConfigurationStoreWritten(bool success) { UNUSED(success); }
498
+  void onConfigurationStoreRead(bool success) { UNUSED(success); }
523 499
 }
524 500
 
525 501
 #endif // MALYAN_LCD

+ 3
- 3
Marlin/src/lcd/ultralcd.cpp 파일 보기

@@ -23,7 +23,7 @@
23 23
 #include "../inc/MarlinConfigPre.h"
24 24
 
25 25
 // These displays all share the MarlinUI class
26
-#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
26
+#if HAS_DISPLAY
27 27
   #include "ultralcd.h"
28 28
   #include "fontutils.h"
29 29
   MarlinUI ui;
@@ -1192,7 +1192,7 @@ void MarlinUI::update() {
1192 1192
 
1193 1193
 #endif // HAS_SPI_LCD
1194 1194
 
1195
-#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
1195
+#if HAS_DISPLAY
1196 1196
 
1197 1197
   #if ENABLED(EXTENSIBLE_UI)
1198 1198
     #include "extensible_ui/ui_api.h"
@@ -1376,4 +1376,4 @@ void MarlinUI::update() {
1376 1376
     }
1377 1377
   #endif
1378 1378
 
1379
-#endif // HAS_SPI_LCD || EXTENSIBLE_UI
1379
+#endif // HAS_DISPLAY

+ 7
- 10
Marlin/src/lcd/ultralcd.h 파일 보기

@@ -268,17 +268,11 @@ public:
268 268
   static void clear_lcd();
269 269
   static void init_lcd();
270 270
 
271
-  #if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI)
271
+  #if HAS_DISPLAY
272
+
272 273
     static void init();
273 274
     static void update();
274 275
     static void set_alert_status_P(PGM_P message);
275
-  #else // NO LCD
276
-    static inline void init() {}
277
-    static inline void update() {}
278
-    static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
279
-  #endif
280
-
281
-  #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
282 276
 
283 277
     static char status_message[];
284 278
     static bool has_status();
@@ -375,9 +369,12 @@ public:
375 369
     static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
376 370
     static void reset_status();
377 371
 
378
-  #else // MALYAN_LCD or NO LCD
372
+  #else // No LCD
379 373
 
374
+    static inline void init() {}
375
+    static inline void update() {}
380 376
     static inline void refresh() {}
377
+    static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
381 378
     static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
382 379
     static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
383 380
     static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
@@ -529,7 +526,7 @@ private:
529 526
 
530 527
   static void _synchronize();
531 528
 
532
-  #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
529
+  #if HAS_DISPLAY
533 530
     static void finish_status(const bool persist);
534 531
   #endif
535 532
 

Loading…
취소
저장