Ender-3 V2 CrealityUI Enhanced (#21942, #22728, #22733)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Miguel Risco-Castillo
2021-09-07 02:15:24 -05:00
committed by Scott Lahteine
parent 54416f780d
commit 6cf2cf7bd4
45 changed files with 6545 additions and 86 deletions

View File

@ -71,9 +71,9 @@
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#endif
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#elif ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../lcd/e3v2/enhanced/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../lcd/e3v2/jyersui/dwin.h"
#endif
@ -441,14 +441,15 @@ typedef struct SettingsDataStruct {
// EXTENSIBLE_UI
//
#if ENABLED(EXTENSIBLE_UI)
// This is a significant hardware change; don't reserve space when not present
uint8_t extui_data[ExtUI::eeprom_data_size];
#endif
//
// DWIN_CREALITY_LCD_JYERSUI
// Ender-3 V2 DWIN
//
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
uint8_t dwin_data[eeprom_data_size];
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
uint8_t dwin_settings[CrealityDWIN.eeprom_data_size];
#endif
@ -1358,9 +1359,16 @@ void MarlinSettings::postprocess() {
#endif
//
// Creality UI Settings
// Creality DWIN User Data
//
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
{
char dwin_data[eeprom_data_size] = { 0 };
DWIN_StoreSettings(dwin_data);
_FIELD_TEST(dwin_data);
EEPROM_WRITE(dwin_data);
}
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
CrealityDWIN.Save_Settings(dwin_settings);
@ -1488,6 +1496,8 @@ void MarlinSettings::postprocess() {
stored_ver[1] = '\0';
}
DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_VERSION)));
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
eeprom_error = true;
}
@ -2249,9 +2259,16 @@ void MarlinSettings::postprocess() {
#endif
//
// Creality UI Settings
// Creality DWIN User Data
//
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
{
const char dwin_data[eeprom_data_size] = { 0 };
_FIELD_TEST(dwin_data);
EEPROM_READ(dwin_data);
if (!validating) DWIN_LoadSettings(dwin_data);
}
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
_FIELD_TEST(dwin_settings);
@ -2340,6 +2357,7 @@ void MarlinSettings::postprocess() {
else if (working_crc != stored_crc) {
eeprom_error = true;
DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_CRC)));
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
}
else if (!validating) {
@ -2656,7 +2674,7 @@ void MarlinSettings::reset() {
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_SetDataDefaults());
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
//