🐛 Fix DGUS displays compile (#22464)

This commit is contained in:
ellensp 2021-07-31 12:50:22 +12:00 committed by Scott Lahteine
parent 22ef6362ae
commit c753071961
8 changed files with 100 additions and 83 deletions

View file

@ -108,14 +108,14 @@ private:
static bool Initialized, no_reentrance;
};
#define GET_VARIABLE(f, t, V...) (&DGUSDisplay::GetVariable<decltype(t), f, t, ##V>)
#define SET_VARIABLE(f, t, V...) (&DGUSDisplay::SetVariable<decltype(t), f, t, ##V>)
extern DGUSDisplay dgusdisplay;
// compile-time x^y
constexpr float cpow(const float x, const int y) { return y == 0 ? 1.0 : x * cpow(x, y - 1); }
///
const uint16_t* DGUSLCD_FindScreenVPMapList(uint8_t screen);
/// Find the flash address of a DGUS_VP_Variable for the VP.
const DGUS_VP_Variable* DGUSLCD_FindVPVar(const uint16_t vp);

View file

@ -41,7 +41,10 @@
uint16_t distanceToMove = 10;
#endif
const uint16_t VPList_Boot[] PROGMEM = { VP_MARLIN_VERSION, 0x0000 };
const uint16_t VPList_Boot[] PROGMEM = {
VP_MARLIN_VERSION,
0x0000
};
const uint16_t VPList_Main[] PROGMEM = {
// VP_M117, for completeness, but it cannot be auto-uploaded.
@ -101,7 +104,7 @@ const uint16_t VPList_Status[] PROGMEM = {
};
const uint16_t VPList_Status2[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_Flowrate_E0,
#if HAS_MULTI_EXTRUDER

View file

@ -42,6 +42,8 @@
#if ENABLED(SDSUPPORT)
static ExtUI::FileList filelist;
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
if (touched_nr > filelist.count()) return;
@ -83,7 +85,7 @@
case 1: // Pause
GotoScreen(MKSLCD_SCREEN_PAUSE);
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
if (!ExtUI::isPrintingFromMediaPaused()) {
ExtUI::pausePrint();
//ExtUI::mks_pausePrint();
@ -409,8 +411,15 @@ bool DGUSScreenHandler::loop() {
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
booted = true;
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
booted = true;
if (TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
GotoScreen(DGUSLCD_SCREEN_POWER_LOSS);
else
GotoScreen(DGUSLCD_SCREEN_MAIN);
}
#endif
return IsScreenComplete();
}

View file

@ -47,7 +47,7 @@ const uint16_t VPList_Boot[] PROGMEM = {
};
const uint16_t VPList_Main[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
// VP_M117, for completeness, but it cannot be auto-uploaded.
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS,
#if HOTENDS >= 2
@ -83,7 +83,7 @@ const uint16_t VPList_Temp[] PROGMEM = {
};
const uint16_t VPList_Status[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set,
#if HOTENDS >= 2
@ -104,7 +104,7 @@ const uint16_t VPList_Status[] PROGMEM = {
};
const uint16_t VPList_Status2[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_Flowrate_E0,
#if HOTENDS >= 2
@ -395,7 +395,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
#if ENABLED(PIDTEMP)
#if ENABLED(PIDTEMPBED)
VPHELPER(VP_BED_PID_P, &thermalManager.temp_bed.pid.Kp, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
VPHELPER(VP_BED_PID_I, &thermalManager.temp_bed.pid.Ki, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
VPHELPER(VP_BED_PID_D, &thermalManager.temp_bed.pid.Kd, ScreenHandler.HandleTemperaturePIDChanged, ScreenHandler.DGUSLCD_SendTemperaturePID),
@ -445,11 +445,11 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),

View file

@ -22,7 +22,7 @@
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(DGUS_LCD_UI_HYPRECY)
#if ENABLED(DGUS_LCD_UI_HIPRECY)
#include "../DGUSScreenHandler.h"
@ -42,6 +42,8 @@
#if ENABLED(SDSUPPORT)
static ExtUI::FileList filelist;
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
if (touched_nr > filelist.count()) return;
@ -415,4 +417,4 @@ bool DGUSScreenHandler::loop() {
return IsScreenComplete();
}
#endif // DGUS_LCD_UI_HYPRECY
#endif // DGUS_LCD_UI_HIPRECY

View file

@ -50,7 +50,7 @@ const uint16_t VPList_Boot[] PROGMEM = {
};
const uint16_t VPList_Main[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded. */
// VP_M117, for completeness, but it cannot be auto-uploaded.
0x0000
};
@ -68,7 +68,7 @@ const uint16_t VPList_Temp[] PROGMEM = {
};
const uint16_t VPList_Status[] PROGMEM = {
/* VP_M117, for completeness, but it cannot be auto-uploaded */
// VP_M117, for completeness, but it cannot be auto-uploaded
#if HAS_HOTEND
VP_T_E0_Is, VP_T_E0_Set,
#if HOTENDS >= 2
@ -162,8 +162,8 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
// Temperature Data
#if HAS_HOTEND
VPHELPER(VP_T_E0_Is, nullptr, nullptr, SET_VARIABLE(getActualTemp_celsius, E0, long)),
VPHELPER(VP_T_E0_Set, nullptr, GET_VARIABLE(setTargetTemp_celsius, E0), SET_VARIABLE(getTargetTemp_celsius, E0)),
VPHELPER(VP_T_E0_Is, &thermalManager.temp_hotend[0].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_T_E0_Set, &thermalManager.temp_hotend[0].target, ScreenHandler.HandleTemperatureChanged, &ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_Flowrate_E0, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_EPos, &destination.e, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
VPHELPER(VP_MOVE_E0, nullptr, ScreenHandler.HandleManualExtrude, nullptr),
@ -194,7 +194,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
#endif
#if HAS_HEATED_BED
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>),
VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay),
VPHELPER(VP_BED_CONTROL, &thermalManager.temp_bed.target, ScreenHandler.HandleHeaterControl, nullptr),
VPHELPER(VP_BED_STATUS, &thermalManager.temp_bed.target, nullptr, ScreenHandler.DGUSLCD_SendHeaterStatusToDisplay),
@ -247,11 +247,11 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_SD_ScrollEvent, nullptr, ScreenHandler.DGUSLCD_SD_ScrollFilelist, nullptr),
VPHELPER(VP_SD_FileSelected, nullptr, ScreenHandler.DGUSLCD_SD_FileSelected, nullptr),
VPHELPER(VP_SD_FileSelectConfirm, nullptr, ScreenHandler.DGUSLCD_SD_StartPrint, nullptr),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename ),
VPHELPER_STR(VP_SD_FileName0, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName1, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName2, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName3, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER_STR(VP_SD_FileName4, nullptr, VP_SD_FileName_LEN, nullptr, ScreenHandler.DGUSLCD_SD_SendFilename),
VPHELPER(VP_SD_ResumePauseAbort, nullptr, ScreenHandler.DGUSLCD_SD_ResumePauseAbort, nullptr),
VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),

View file

@ -85,7 +85,7 @@
case 1: // Pause
GotoScreen(MKSLCD_SCREEN_PAUSE);
GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
if (!ExtUI::isPrintingFromMediaPaused()) {
ExtUI::pausePrint();
//ExtUI::mks_pausePrint();
@ -411,9 +411,12 @@ bool DGUSScreenHandler::loop() {
if (!booted && TERN0(POWER_LOSS_RECOVERY, recovery.valid()))
booted = true;
if (!booted && ELAPSED(ms, TERN(USE_MKS_GREEN_UI, 1000, BOOTSCREEN_TIMEOUT)))
if (!booted && ELAPSED(ms, BOOTSCREEN_TIMEOUT)) {
booted = true;
GotoScreen(TERN0(POWER_LOSS_RECOVERY, recovery.valid()) ? DGUSLCD_SCREEN_POWER_LOSS : DGUSLCD_SCREEN_MAIN);
}
#endif
return IsScreenComplete();
}