Consolidate Malyan LCD and ExtUI

This commit is contained in:
Scott Lahteine 2019-05-07 20:32:50 -05:00
parent 6811e2921b
commit 23ec650410
5 changed files with 33 additions and 57 deletions

View File

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

View File

@ -329,8 +329,14 @@
#define ULTRA_LCD #define ULTRA_LCD
#endif #endif
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
#if ENABLED(MALYAN_LCD)
#define EXTENSIBLE_UI
#endif
// Aliases for LCD features // Aliases for LCD features
#define HAS_SPI_LCD ENABLED(ULTRA_LCD) #define HAS_SPI_LCD ENABLED(ULTRA_LCD)
#define HAS_DISPLAY (HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI))
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD) #define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD) #define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)) #define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
@ -513,9 +519,6 @@
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif #endif
#if ENABLED(MALYAN_LCD)
#define EXTENSIBLE_UI
#endif
#define HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_RESUME_CONTINUE ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER) #define HAS_RESUME_CONTINUE ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER)
#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)

View File

@ -474,52 +474,28 @@ namespace ExtUI {
#endif #endif
} }
void onPrinterKilled(PGM_P const msg) {}
void onMediaInserted() {};
void onMediaError() {};
void onMediaRemoved() {};
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
void onPrintTimerStarted() {}
void onPrintTimerPaused() {}
void onPrintTimerStopped() {}
void onFilamentRunout() {}
void onUserConfirmRequired(const char * const msg) {}
void onStatusChanged(const char * const msg) { void onStatusChanged(const char * const msg) {
write_to_lcd_P(PSTR("{E:")); write_to_lcd_P(PSTR("{E:"));
write_to_lcd(msg); write_to_lcd(msg);
write_to_lcd_P("}"); write_to_lcd_P("}");
} }
// Not needed for Malyan LCD
void onPrinterKilled(PGM_P const msg) { UNUSED(msg); }
void onMediaInserted() {};
void onMediaError() {};
void onMediaRemoved() {};
void onPlayTone(const uint16_t frequency, const uint16_t duration) { UNUSED(frequency); UNUSED(duration); }
void onPrintTimerStarted() {}
void onPrintTimerPaused() {}
void onPrintTimerStopped() {}
void onFilamentRunout() {}
void onUserConfirmRequired(const char * const msg) { UNUSED(msg); }
void onFactoryReset() {} void onFactoryReset() {}
void onStoreSettings(char *buff) { UNUSED(buff); }
void onStoreSettings(char *buff) { void onLoadSettings(const char *buff) { UNUSED(buff); }
// This is called when saving to EEPROM (i.e. M500). If the ExtUI needs void onConfigurationStoreWritten(bool success) { UNUSED(success); }
// permanent data to be stored, it can write up to eeprom_data_size bytes void onConfigurationStoreRead(bool success) { UNUSED(success); }
// into buff.
// Example:
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
// memcpy(buff, &myDataStruct, sizeof(myDataStruct));
}
void onLoadSettings(const char *buff) {
// This is called while loading settings from EEPROM. If the ExtUI
// needs to retrieve data, it should copy up to eeprom_data_size bytes
// from buff
// Example:
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
// memcpy(&myDataStruct, buff, sizeof(myDataStruct));
}
void onConfigurationStoreWritten(bool success) {
// This is called after the entire EEPROM has been written,
// whether successful or not.
}
void onConfigurationStoreRead(bool success) {
// This is called after the entire EEPROM has been read,
// whether successful or not.
}
} }
#endif // MALYAN_LCD #endif // MALYAN_LCD

View File

@ -23,7 +23,7 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
// These displays all share the MarlinUI class // These displays all share the MarlinUI class
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) #if HAS_DISPLAY
#include "ultralcd.h" #include "ultralcd.h"
#include "fontutils.h" #include "fontutils.h"
MarlinUI ui; MarlinUI ui;
@ -1192,7 +1192,7 @@ void MarlinUI::update() {
#endif // HAS_SPI_LCD #endif // HAS_SPI_LCD
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) #if HAS_DISPLAY
#if ENABLED(EXTENSIBLE_UI) #if ENABLED(EXTENSIBLE_UI)
#include "extensible_ui/ui_api.h" #include "extensible_ui/ui_api.h"
@ -1376,4 +1376,4 @@ void MarlinUI::update() {
} }
#endif #endif
#endif // HAS_SPI_LCD || EXTENSIBLE_UI #endif // HAS_DISPLAY

View File

@ -268,17 +268,11 @@ public:
static void clear_lcd(); static void clear_lcd();
static void init_lcd(); static void init_lcd();
#if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI) #if HAS_DISPLAY
static void init(); static void init();
static void update(); static void update();
static void set_alert_status_P(PGM_P message); static void set_alert_status_P(PGM_P message);
#else // NO LCD
static inline void init() {}
static inline void update() {}
static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
#endif
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)
static char status_message[]; static char status_message[];
static bool has_status(); static bool has_status();
@ -375,9 +369,12 @@ public:
static void status_printf_P(const uint8_t level, PGM_P const fmt, ...); static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
static void reset_status(); static void reset_status();
#else // MALYAN_LCD or NO LCD #else // No LCD
static inline void init() {}
static inline void update() {}
static inline void refresh() {} static inline void refresh() {}
static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); } static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
@ -529,7 +526,7 @@ private:
static void _synchronize(); static void _synchronize();
#if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) #if HAS_DISPLAY
static void finish_status(const bool persist); static void finish_status(const bool persist);
#endif #endif