Skip to content

Commit

Permalink
Update - revert popup to fix PIDTuning, add explicit defs
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 committed Oct 5, 2024
1 parent bbe5e05 commit 955a014
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 38 deletions.
3 changes: 2 additions & 1 deletion Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ typedef struct {
#endif

#if ENABLED(FWRETRACT)
float retract[EXTRUDERS], retract_hop;
float retract[EXTRUDERS];
float retract_hop;
#endif

// Mixing extruder and gradient
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t
void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) {
gcode.process_subcommands_now(F("G28O"));
if (!zmove) {
DWIN_Draw_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done."));
gcode.process_subcommands_now(TS(F("G0F600Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3))); //gcode.process_subcommands_now(F("G0F600Z" STRINGIFY(Z_CLEARANCE_BETWEEN_PROBES)));
DWIN_Show_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done."));
HMI_SaveProcessID(NothingToDo);
gcode.process_subcommands_now(F("G0F600Z" STRINGIFY(Z_CLEARANCE_BETWEEN_PROBES))); // gcode.process_subcommands_now(TS(F("G0F600Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3)));
gcode.process_subcommands_now(TS(F("G42F4000I"), mesh_x, F("J"), mesh_y));
}
planner.synchronize();
Expand Down
53 changes: 30 additions & 23 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,8 @@ void EachMomentUpdate() {
#if ENABLED(PROUI_ITEM_PLOT)
case PlotProcess: {
if (HMI_flag.abort_flag || HMI_flag.pause_flag || print_job_timer.isPaused()) {
return HMI_ReturnScreen();
HMI_ReturnScreen();
break;
}
}
#endif
Expand Down Expand Up @@ -1453,6 +1454,7 @@ void EachMomentUpdate() {
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename());
DWIN_Print_Header(card.longest_filename()); // Save filename
Draw_Select_Highlight(HMI_flag.select_flag);
DWIN_UpdateLCD();
}

void OnClick_PowerLossRecovery() {
Expand Down Expand Up @@ -1540,27 +1542,34 @@ void EachMomentUpdate() {

void DWIN_HandleScreen() {
switch (checkkey) {
case MainMenu: HMI_MainMenu(); break;
case Menu: HMI_Menu(); break;
case SetInt: HMI_SetDraw(); break;
case SetFloat: HMI_SetDraw(); break;
case SetPInt: HMI_SetPInt(); break;
case SetPFloat: HMI_SetPFloat(); break;
case SetIntNoDraw: HMI_SetNoDraw(); break;
case PrintProcess: HMI_Printing(); break;
case Popup: HMI_Popup(); break;
case MainMenu: HMI_MainMenu(); break;
case Menu: HMI_Menu(); break;
case SetInt: HMI_SetDraw(); break;
case SetFloat: HMI_SetDraw(); break;
case SetPInt: HMI_SetPInt(); break;
case SetPFloat: HMI_SetPFloat(); break;
case SetIntNoDraw: HMI_SetNoDraw(); break;
case PrintProcess: HMI_Printing(); break;
case Popup: HMI_Popup(); break;
OPTCODE(HAS_LOCKSCREEN,
case Locked: HMI_LockScreen(); break)
case Locked: HMI_LockScreen(); break)

TERN_(HAS_BED_PROBE,
case Leveling:)
case PrintDone:
TERN_(HAS_ESDIAG,
case ESDiagProcess:)
case WaitResponse: HMI_WaitForUser(); break;
case WaitResponse: HMI_WaitForUser(); break;

OPTCODE(PROUI_ITEM_PLOT,
case PlotProcess: PlotChange(); HMI_WaitForUser(); break)

case Homing:
TERN_(HAS_PID_HEATING,
case PIDProcess:)
TERN_(MPCTEMP,
case MPCProcess:)
case NothingToDo:
default: break;
}
}
Expand Down Expand Up @@ -1602,10 +1611,6 @@ void HMI_SaveProcessID(const uint8_t id) {
case PlotProcess:)
case WaitResponse:
wait_for_user = true;
break;
case NothingToDo:
wait_for_user = false;
break;
default: break;
}
}
Expand Down Expand Up @@ -1756,7 +1761,7 @@ void HMI_ReturnScreen() {
#if PROUI_TUNING_GRAPH
DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_NOZZLE));
DWIN_Show_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_NOZZLE));
#endif
break;
#endif
Expand All @@ -1766,7 +1771,7 @@ void HMI_ReturnScreen() {
#if PROUI_TUNING_GRAPH
DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_BED));
DWIN_Show_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_BED));
#endif
break;
#endif
Expand All @@ -1776,7 +1781,7 @@ void HMI_ReturnScreen() {
#if PROUI_TUNING_GRAPH
DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_CHAMBER));
DWIN_Show_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_PID_FOR_CHAMBER));
#endif
break;
#endif
Expand Down Expand Up @@ -1815,7 +1820,7 @@ void HMI_ReturnScreen() {
#if PROUI_TUNING_GRAPH
DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_NOZZLE_RUN));
DWIN_Show_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_NOZZLE_RUN));
#endif
break;
case MPC_TEMP_ERROR:
Expand Down Expand Up @@ -1851,7 +1856,7 @@ void DWIN_HomingStart() {
DEBUG_ECHOLNPGM("DWIN_HomingStart");
if (checkkey != NothingToDo || checkkey != Leveling) { HMI_SaveProcessID(Homing); }
Title.ShowCaption(GET_TEXT_F(MSG_HOMING));
DWIN_Draw_Popup(TERN(TJC_DISPLAY, ICON_BLTouch, ICON_Printer_0), GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
DWIN_Show_Popup(TERN(TJC_DISPLAY, ICON_BLTouch, ICON_Printer_0), GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
}

void DWIN_HomingDone() {
Expand Down Expand Up @@ -2312,8 +2317,9 @@ void MarlinUI::update() {
#endif

void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const) {
DWIN_Draw_Popup(TERN(TJC_DISPLAY, ICON_BLTouch, ICON_Printer_0), GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error);
DWIN_Show_Popup(TERN(TJC_DISPLAY, ICON_BLTouch, ICON_Printer_0), GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error);
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF));
DWIN_UpdateLCD();
}

#if ENABLED(ADVANCED_PAUSE_FEATURE)
Expand Down Expand Up @@ -4451,7 +4457,8 @@ void Draw_MaxAccel_Menu() {
void LaserRunRange() {
if (!laser_device.is_laser_device()) return;
if (!all_axes_trusted()) return LCD_MESSAGE_F("First set home");
DWIN_Draw_Popup(ICON_TempTooHigh, F("LASER"), F("Run Range"), BTN_Cancel);
DWIN_Show_Popup(ICON_TempTooHigh, F("LASER"), F("Run Range"), BTN_Cancel);
HMI_SaveProcessID(WaitResponse);
laser_device.laser_range();
}

Expand Down
13 changes: 7 additions & 6 deletions Marlin/src/lcd/e3v2/proui/dwin_popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,19 @@ void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
DWIN_Draw_Rectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
DWIN_Draw_Rectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
DWIN_Draw_Rectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
HMI_SaveProcessID(Popup);
DWIN_UpdateLCD();
}

void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
DWIN_Draw_Popup(icon, F("Please confirm"), fmsg2);
DWIN_Show_Popup(icon, F("Please confirm"), fmsg2);
DWINUI::Draw_Button(BTN_Confirm, 26, 280);
DWINUI::Draw_Button(BTN_Cancel, 146, 280);
Draw_Select_Highlight(HMI_flag.select_flag);
DWIN_UpdateLCD();
}

void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/) {
Draw_Popup = fnDraw;
ClickPopup = fnClick;
Draw_Popup = fnDraw;
ClickPopup = fnClick;
HMI_SaveProcessID(Popup);
HMI_flag.select_flag = false;
Draw_Popup();
Expand All @@ -68,13 +67,15 @@ void HMI_Popup() {
if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
const bool change = encoder_diffState != ENCODER_DIFF_CW;
Draw_Select_Highlight(change, HighlightYPos);
DWIN_UpdateLCD();
}
}
}

#if ENABLED(ADVANCED_PAUSE_FEATURE)
void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button/*=0*/) {
DWIN_Draw_Popup(ICON_Pause_1, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button);
HMI_SaveProcessID(button ? WaitResponse : NothingToDo);
DWIN_Show_Popup(ICON_Pause_1, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button);
}

void Draw_Popup_FilamentPurge() {
Expand Down
16 changes: 11 additions & 5 deletions Marlin/src/lcd/e3v2/proui/dwin_popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,24 @@ void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8
if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
if (button) DWINUI::Draw_Button(button, 86, 280, true);
HMI_SaveProcessID(button ? Popup : NothingToDo);
}

template<typename T, typename U>
void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
DWIN_Draw_Popup(icon, amsg1, amsg2, button);
DWIN_UpdateLCD();
}

template<typename T, typename U>
inline void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
HMI_SaveProcessID(WaitResponse);
DWIN_Show_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
}

template<typename T, typename U>
inline void DWIN_Popup_Continue(const uint8_t icon, T amsg1, U amsg2) {
DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Continue); // Button Continue
void DWIN_Popup_Continue(const uint8_t icon, T amsg1, U amsg2) {
HMI_SaveProcessID(WaitResponse);
DWIN_Show_Popup(icon, amsg1, amsg2, BTN_Continue); // Button Continue
}

#if DEBUG_DWIN
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ void Preview::drawFromSD() {
DWINUI::Draw_Button(BTN_Cancel, 146, 290);
if (fileprop.thumbsize) show();
Draw_Select_Highlight(false, 290);
DWIN_UpdateLCD();
}

void Preview::invalidate() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/libs/bresenham.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Bresenham {
public:

static T divisor;
static value[Cfg::SIZE], dir[Cfg::SIZE], dividend[Cfg::SIZE], counter[Cfg::SIZE];
static T value[Cfg::SIZE], dir[Cfg::SIZE], dividend[Cfg::SIZE], counter[Cfg::SIZE];

// Default: Instantiate all items with the identical parameters
Bresenham(const T &inDivisor=1, const int8_t &inDir=1, const T &inDividend=1, const T &inValue=0) {
Expand Down

0 comments on commit 955a014

Please sign in to comment.