Skip to content

Commit

Permalink
Fix bugs and implement user feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mriscoc committed Jan 22, 2024
1 parent c4b9837 commit ec573df
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
18 changes: 12 additions & 6 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ void _drawXYZPosition(const bool force) {
}

void updateVariable() {
TERN_(DEBUG_DWIN,DWINUI::drawInt(COLOR_YELLOW, COLOR_BG_BLACK, 2, DWIN_WIDTH-6*DWINUI::fontWidth(), 6, checkkey));
TERN_(DEBUG_DWIN,DWINUI::drawInt(COLOR_LIGHT_RED, COLOR_BG_BLACK, 2, DWIN_WIDTH-6*DWINUI::fontWidth(), 6, checkkey));
TERN_(DEBUG_DWIN,DWINUI::drawInt(COLOR_YELLOW, COLOR_BG_BLACK, 2, DWIN_WIDTH-3*DWINUI::fontWidth(), 6, last_checkkey));

_drawXYZPosition(false);
Expand Down Expand Up @@ -1385,7 +1385,7 @@ void dwinHandleScreen() {
case ID_SetIntNoDraw: hmiSetNoDraw(); break;
case ID_PrintProcess: hmiPrinting(); break;
case ID_Popup: hmiPopup(); break;
case ID_Leveling: TERN_(PROUI_EX, hmiWaitForUser();) break;
case ID_Leveling: TERN_(PROUI_EX, hmiWaitForUser()); break;
#if HAS_LOCKSCREEN
case ID_Locked: hmiLockScreen(); break;
#endif
Expand Down Expand Up @@ -1437,7 +1437,7 @@ void hmiReturnScreen() {

void dwinHomingStart() {
DEBUG_ECHOLNPGM("dwinHomingStart");
hmiSaveProcessID(ID_Homing);
if (checkkey != ID_NothingToDo) hmiSaveProcessID(ID_Homing);
title.draw(GET_TEXT_F(MSG_HOMING));
dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
}
Expand All @@ -1453,7 +1453,7 @@ void dwinHomingDone() {
#endif
if (last_checkkey == ID_PrintDone)
gotoPrintDone();
else
else if (checkkey != ID_NothingToDo)
hmiReturnScreen();
}

Expand All @@ -1463,10 +1463,10 @@ void dwinHomingDone() {
DEBUG_ECHOLNPGM("dwinLevelingStart");
#if HAS_BED_PROBE
hmiSaveProcessID(ID_Leveling);
TERN_(PROUI_EX,proUIEx.cancel_lev = 0);
title.draw(GET_TEXT_F(MSG_BED_LEVELING));
#if PROUI_EX
meshViewer.drawBackground(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
proUIEx.cancel_lev = 0;
DWINUI::drawButton(BTN_Cancel, 86, 305);
#else
dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT), TERN(PROUI_EX, BTN_Cancel, 0));
Expand Down Expand Up @@ -1597,6 +1597,7 @@ void dwinHomingDone() {
void dwinPidTuning(tempcontrol_t result) {
hmiValue.tempControl = result;
switch (result) {
#if ENABLED(PIDTEMPBED)
case PIDTEMPBED_START:
hmiSaveProcessID(ID_PIDProcess);
#if HAS_PLOT
Expand All @@ -1605,6 +1606,8 @@ void dwinHomingDone() {
dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BED_IS_RUN));
#endif
break;
#endif
#if ENABLED(PIDTEMP)
case PIDTEMP_START:
hmiSaveProcessID(ID_PIDProcess);
#if HAS_PLOT
Expand All @@ -1613,6 +1616,7 @@ void dwinHomingDone() {
dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_NOZZLE_IS_RUN));
#endif
break;
#endif
case PID_BAD_HEATER_ID:
checkkey = last_checkkey;
dwinPopupContinue(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_BAD_HEATER_ID));
Expand Down Expand Up @@ -2276,7 +2280,7 @@ void applyMove() {
#endif

#if HAS_HOME_OFFSET
void applyHomeOffset() { set_home_offset(hmiValue.select, menuData.value / MINUNITMULT); }
void applyHomeOffset() { set_home_offset((AxisEnum)hmiValue.select, menuData.value / MINUNITMULT); }
void setHomeOffsetX() { hmiValue.select = X_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); }
void setHomeOffsetY() { hmiValue.select = Y_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); }
void setHomeOffsetZ() { hmiValue.select = Z_AXIS; setPFloatOnClick( -2, 2, UNITFDIGITS, applyHomeOffset); }
Expand Down Expand Up @@ -2654,9 +2658,11 @@ void drawPrepareMenu() {

#if ALL(HAS_BED_PROBE, HAS_TRAMMING_WIZARD)
void runTrammingWizard() {
hmiSaveProcessID(ID_NothingToDo);
meshViewer.meshfont = font8x16;
trammingWizard();
meshViewer.meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
hmiSaveProcessID(ID_WaitResponse);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/dwinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ uint16_t Title::backColor = defColorTitleBg;
void Title::draw(const char * const caption) {
dwinDrawRectangle(1, backColor, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
#if ENABLED(TITLE_CENTERED)
drawCenteredString(false, DWIN_FONT_HEAD, textColor, backColor, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, caption);
DWINUI::drawCenteredString(false, DWIN_FONT_HEAD, textColor, backColor, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, caption);
#else
dwinDrawString(false, DWIN_FONT_HEAD, textColor, backColor, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, caption);
#endif
Expand Down
18 changes: 12 additions & 6 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

// Check the integrity of data offsets.
// Can be disabled for production build.
//#define DEBUG_EEPROM_READWRITE
//#define DEBUG_EEPROM_OBSERVE
// #define DEBUG_EEPROM_READWRITE
// #define DEBUG_EEPROM_OBSERVE

#include "settings.h"

Expand Down Expand Up @@ -707,11 +707,12 @@ typedef struct SettingsDataStruct {

} SettingsData;

//static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");
constexpr size_t settingsdata_size = sizeof(SettingsData);
static_assert(settingsdata_size <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");

MarlinSettings settings;

uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); }
uint16_t MarlinSettings::datasize() { return settingsdata_size; }

/**
* Post-process after Retrieve or Reset
Expand Down Expand Up @@ -846,11 +847,16 @@ void MarlinSettings::postprocess() {
#endif

#if ENABLED(DEBUG_EEPROM_OBSERVE)
#define EEPROM_READ(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_(V); }while(0)
#define EEPROM_READ_ALWAYS(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_ALWAYS_(V); }while(0)
#define EEPROM_READ(V...) do{ SERIAL_ECHOPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_(V); SERIAL_ECHOLNPGM(" CRC: ", working_crc); }while(0)
#define EEPROM_READ_ALWAYS(V...) do{ SERIAL_ECHOPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_ALWAYS_(V); SERIAL_ECHOLNPGM(" CRC: ", working_crc); }while(0)
#define EEPROM_WRITE(V...) do{ SERIAL_ECHOPGM("WRITE: ", F(STRINGIFY(FIRST(V)))); EEPROM_WRITE_(V); SERIAL_ECHOLNPGM(" CRC: ", working_crc); }while(0)
// #define EEPROM_READ(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_(V); }while(0)
// #define EEPROM_READ_ALWAYS(V...) do{ SERIAL_ECHOLNPGM("READ: ", F(STRINGIFY(FIRST(V)))); EEPROM_READ_ALWAYS_(V); }while(0)
// #define EEPROM_WRITE(V...) do{ SERIAL_ECHOLNPGM("WRITE: ", F(STRINGIFY(FIRST(V)))); EEPROM_WRITE_(V); }while(0)
#else
#define EEPROM_READ(V...) EEPROM_READ_(V)
#define EEPROM_READ_ALWAYS(V...) EEPROM_READ_ALWAYS_(V)
#define EEPROM_WRITE(V...) EEPROM_WRITE_(V)
#endif

const char version[4] = EEPROM_VERSION;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class MarlinSettings {
static void EEPROM_SKIP(const T &VAR) { eeprom_index += sizeof(VAR); }

template<typename T>
static void EEPROM_WRITE(const T &VAR) {
static void EEPROM_WRITE_(const T &VAR) {
persistentStore.write_data(eeprom_index, (const uint8_t *) &VAR, sizeof(VAR), &working_crc);
}

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTxxC10.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
* ------
* EXP1
*/

#define EXP1_01_PIN PC0
#define EXP1_02_PIN PB2
#define EXP1_03_PIN PA2
Expand Down

0 comments on commit ec573df

Please sign in to comment.