diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h
index 515d5f7984ac..3faef307a8ae 100644
--- a/Marlin/src/inc/Conditionals_post.h
+++ b/Marlin/src/inc/Conditionals_post.h
@@ -2504,9 +2504,15 @@
// PID heating
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
#define HAS_PID_HEATING 1
- #if ENABLED(DWIN_LCD_PROUI) && EITHER(PIDTEMP, PIDTEMPBED)
+#endif
+
+#if ENABLED(DWIN_LCD_PROUI)
+ #if EITHER(PIDTEMP, PIDTEMPBED)
#define DWIN_PID_TUNE 1
#endif
+ #if EITHER(DWIN_PID_TUNE, MPCTEMP) && DISABLED(DISABLE_TUNING_GRAPH)
+ #define SHOW_TUNING_GRAPH 1
+ #endif
#endif
// Thermal protection
diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp
index 4be081944138..e8430d591c98 100644
--- a/Marlin/src/lcd/e3v2/proui/dwin.cpp
+++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp
@@ -31,37 +31,6 @@
#if ENABLED(DWIN_LCD_PROUI)
-#if DISABLED(LIMITED_MAX_FR_EDITING)
- #warning "LIMITED_MAX_FR_EDITING is recommended with ProUI."
-#endif
-#if DISABLED(LIMITED_MAX_ACCEL_EDITING)
- #warning "LIMITED_MAX_ACCEL_EDITING is recommended with ProUI."
-#endif
-#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING)
- #warning "LIMITED_JERK_EDITING is recommended with ProUI."
-#endif
-#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
- #warning "INDIVIDUAL_AXIS_HOMING_SUBMENU is recommended with ProUI."
-#endif
-#if DISABLED(SET_PROGRESS_MANUALLY)
- #warning "SET_PROGRESS_MANUALLY is recommended with ProUI."
-#endif
-#if DISABLED(STATUS_MESSAGE_SCROLLING)
- #warning "STATUS_MESSAGE_SCROLLING is recommended with ProUI."
-#endif
-#if DISABLED(BAUD_RATE_GCODE)
- #warning "BAUD_RATE_GCODE is recommended with ProUI."
-#endif
-#if DISABLED(SOUND_MENU_ITEM)
- #warning "SOUND_MENU_ITEM is recommended with ProUI."
-#endif
-#if DISABLED(PRINTCOUNTER)
- #warning "PRINTCOUNTER is recommended with ProUI."
-#endif
-#if HAS_MESH && DISABLED(MESH_EDIT_MENU)
- #warning "MESH_EDIT_MENU is recommended with ProUI."
-#endif
-
#include "../../fontutils.h"
#include "../../marlinui.h"
@@ -142,7 +111,7 @@
#include "endstop_diag.h"
#endif
-#if HAS_PIDPLOT
+#if SHOW_TUNING_GRAPH
#include "plot.h"
#endif
@@ -297,6 +266,9 @@ MenuClass *MaxAccelMenu = nullptr;
MenuClass *MaxJerkMenu = nullptr;
#endif
MenuClass *StepsMenu = nullptr;
+#if ENABLED(MPCTEMP)
+ MenuClass *HotendMPCMenu = nullptr;
+#endif
#if ENABLED(PIDTEMP)
MenuClass *HotendPIDMenu = nullptr;
#endif
@@ -1275,8 +1247,8 @@ void EachMomentUpdate() {
#if HAS_ESDIAG
if (checkkey == ESDiagProcess) ESDiag.Update();
#endif
- #if HAS_PIDPLOT
- if (checkkey == PidProcess) Plot.Update((HMI_value.pidresult == PIDTEMP_START) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed());
+ #if SHOW_TUNING_GRAPH
+ if (checkkey == PidProcess) plot.Update((HMI_value.pidresult == PIDTEMP_START) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed());
#endif
}
@@ -1498,36 +1470,64 @@ void DWIN_LevelingDone() {
}
#endif
-// PID process
+// PID/MPC process
-#if BOTH(HAS_PIDPLOT, DWIN_PID_TUNE)
+#if SHOW_TUNING_GRAPH
+
+ #include "plot.h"
- void DWIN_Draw_PIDPopup() {
- frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 };
+ celsius_t _maxtemp, _target;
+ void DWIN_Draw_PID_MPC_Popup() {
+ constexpr frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 };
DWINUI::ClearMainArea();
Draw_Popup_Bkgd();
- DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE));
- DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius"));
- switch (HMI_value.pidresult) {
- #if ENABLED(PIDTEMP)
+
+ #if ENABLED(MPCTEMP)
+
+ switch (HMI_value.pidresult) {
+ case MPCTEMP_START:
+ _maxtemp = thermalManager.hotend_maxtemp[0];
+ _target = 200;
+ DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE));
+ DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius"));
+ DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running."));
+ break;
+ case PIDTEMPBED_START:
+ _maxtemp = BED_MAXTEMP;
+ _target = HMI_data.BedPidT;
+ DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE));
+ DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius"));
+ DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running."));
+ break;
+ default: return;
+ }
+
+ #else // PID
+
+ DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE));
+ DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius"));
+
+ switch (HMI_value.pidresult) {
case PIDTEMP_START:
+ _maxtemp = thermalManager.hotend_maxtemp[0];
+ _target = HMI_data.HotendPidT;
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running."));
- Plot.Draw(gfrm, thermalManager.hotend_maxtemp[0], HMI_data.HotendPidT);
- DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.HotendPidT);
break;
- #endif
- #if ENABLED(PIDTEMPBED)
case PIDTEMPBED_START:
+ _maxtemp = BED_MAXTEMP;
+ _target = HMI_data.BedPidT;
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running."));
- Plot.Draw(gfrm, BED_MAXTEMP, HMI_data.BedPidT);
- DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.BedPidT);
break;
- #endif
- default: break;
- }
+ default: return;
+ }
+
+ #endif // PID
+
+ plot.Draw(gfrm, _maxtemp, _target);
+ DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target);
}
-#endif
+#endif // SHOW_TUNING_GRAPH
#if DWIN_PID_TUNE
@@ -1542,40 +1542,40 @@ void DWIN_LevelingDone() {
}
}
- void DWIN_PidTuning(pidresult_t result) {
+ void DWIN_PidTuning(tempcontrol_t result) {
HMI_value.pidresult = result;
switch (result) {
#if ENABLED(PIDTEMP)
case PIDTEMP_START:
HMI_SaveProcessID(PidProcess);
- #if HAS_PIDPLOT
- DWIN_Draw_PIDPopup();
+ #if SHOW_TUNING_GRAPH
+ DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running."));
#endif
break;
- case PID_BAD_HEATER_ID:
+ case PID_TEMP_TOO_HIGH:
checkkey = last_checkkey;
- DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_BAD_HEATER_ID));
+ DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH));
break;
#endif
#if ENABLED(PIDTEMPBED)
case PIDTEMPBED_START:
HMI_SaveProcessID(PidProcess);
- #if HAS_PIDPLOT
- DWIN_Draw_PIDPopup();
+ #if SHOW_TUNING_GRAPH
+ DWIN_Draw_PID_MPC_Popup();
#else
DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running."));
#endif
break;
#endif
- case PID_TUNING_TIMEOUT:
+ case PID_BAD_HEATER_ID:
checkkey = last_checkkey;
- DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT));
+ DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID));
break;
- case PID_TEMP_TOO_HIGH:
+ case PID_TUNING_TIMEOUT:
checkkey = last_checkkey;
- DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH));
+ DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT));
break;
case PID_DONE:
checkkey = last_checkkey;
@@ -1589,6 +1589,43 @@ void DWIN_LevelingDone() {
#endif // DWIN_PID_TUNE
+#if ENABLED(MPCTEMP)
+
+ void DWIN_MPCTuning(tempcontrol_t result) {
+ HMI_value.pidresult = result;
+ switch (result) {
+ case MPCTEMP_START:
+ HMI_SaveProcessID(MPCProcess);
+ #if SHOW_TUNING_GRAPH
+ DWIN_Draw_PID_MPC_Popup();
+ #else
+ DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running."));
+ #endif
+ break;
+ case MPC_TEMP_ERROR:
+ checkkey = last_checkkey;
+ DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR));
+ ui.reset_alert_level();
+ break;
+ case MPC_INTERRUPTED:
+ checkkey = last_checkkey;
+ DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE STR_MPC_AUTOTUNE_INTERRUPTED));
+ ui.reset_alert_level();
+ break;
+ case MPC_DONE:
+ checkkey = last_checkkey;
+ DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE));
+ ui.reset_alert_level();
+ break;
+ default:
+ checkkey = last_checkkey;
+ ui.reset_alert_level();
+ break;
+ }
+ }
+
+#endif // MPCTEMP
+
// Started a Print Job
void DWIN_Print_Started() {
DEBUG_ECHOLNPGM("DWIN_Print_Started: ", SD_Printing());
@@ -3054,7 +3091,7 @@ void Draw_Control_Menu() {
void Draw_AdvancedSettings_Menu() {
checkkey = Menu;
- if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 18)) {
+ if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 19)) {
BACK_ITEM(Goto_Main_Menu);
#if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom);
@@ -3069,6 +3106,9 @@ void Draw_AdvancedSettings_Menu() {
#if ENABLED(PIDTEMP)
MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu);
#endif
+ #if ENABLED(MPCTEMP)
+ MENU_ITEM_F(ICON_MPCNozzle, STR_MPC_AUTOTUNE " Settings", onDrawSubMenu, Draw_HotendMPC_Menu);
+ #endif
#if ENABLED(PIDTEMPBED)
MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, Draw_BedPID_Menu);
#endif
@@ -3500,6 +3540,38 @@ void Draw_Steps_Menu() {
#endif
+#if ENABLED(MPCTEMP)
+
+ void HotendMPC() { thermalManager.MPC_autotune(); }
+ void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); }
+ void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); }
+ void SetSensorRespons() { SetPFloatOnClick(0, 1, 4); }
+ void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); }
+ #if ENABLED(MPC_INCLUDE_FAN)
+ void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); }
+ void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); }
+ void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); }
+ #endif
+
+ void Draw_HotendMPC_Menu() {
+ checkkey = Menu;
+ if (SET_MENU_F(HotendMPCMenu, STR_MPC_AUTOTUNE " Settings", 7)) {
+ MPC_t &mpc = thermalManager.temp_hotend[0].mpc;
+ BACK_ITEM(Draw_AdvancedSettings_Menu);
+ MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, HotendMPC);
+ EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power);
+ EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity);
+ EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorRespons, &mpc.sensor_responsiveness);
+ EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0);
+ #if ENABLED(MPC_INCLUDE_FAN)
+ EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment);
+ #endif
+ }
+ UpdateMenu(HotendMPCMenu);
+ }
+
+#endif // MPCTEMP
+
#if ENABLED(PIDTEMPBED)
void Draw_BedPID_Menu() {
diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h
index bc050abd2e1e..112df5cae144 100644
--- a/Marlin/src/lcd/e3v2/proui/dwin.h
+++ b/Marlin/src/lcd/e3v2/proui/dwin.h
@@ -70,17 +70,30 @@ enum processID : uint8_t {
WaitResponse,
Homing,
PidProcess,
+ MPCProcess,
NothingToDo
};
-enum pidresult_t : uint8_t {
- PIDTEMP_START = 0,
- PIDTEMPBED_START,
- PID_BAD_HEATER_ID,
- PID_TEMP_TOO_HIGH,
- PID_TUNING_TIMEOUT,
- PID_DONE,
-};
+#if EITHER(DWIN_PID_TUNE, MPCTEMP)
+
+ enum tempcontrol_t : uint8_t {
+ #if DWIN_PID_TUNE
+ PID_DONE,
+ PIDTEMP_START,
+ PIDTEMPBED_START,
+ PID_BAD_HEATER_ID,
+ PID_TEMP_TOO_HIGH,
+ PID_TUNING_TIMEOUT,
+ #endif
+ #if ENABLED(MPCTEMP)
+ MPC_DONE,
+ MPCTEMP_START,
+ MPC_TEMP_ERROR,
+ MPC_INTERRUPTED
+ #endif
+ };
+
+#endif
#define DWIN_CHINESE 123
#define DWIN_ENGLISH 0
@@ -142,7 +155,7 @@ static constexpr size_t eeprom_data_size = sizeof(HMI_data_t);
typedef struct {
int8_t Color[3]; // Color components
#if DWIN_PID_TUNE
- pidresult_t pidresult = PID_DONE;
+ tempcontrol_t pidresult = PID_DONE;
#endif
uint8_t Select = 0; // Auxiliary selector variable
AxisEnum axis = X_AXIS; // Axis Select
@@ -361,7 +374,7 @@ void Draw_Steps_Menu();
#if DWIN_PID_TUNE
#include "../../../module/temperature.h"
void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp);
- void DWIN_PidTuning(pidresult_t result);
+ void DWIN_PidTuning(tempcontrol_t result);
#if ENABLED(PIDTEMP)
void Draw_HotendPID_Menu();
#endif
@@ -369,3 +382,9 @@ void Draw_Steps_Menu();
void Draw_BedPID_Menu();
#endif
#endif
+
+// MPC
+#if ENABLED(MPCTEMP)
+ void DWIN_MPCTuning(tempcontrol_t result);
+ void Draw_HotendMPC_Menu();
+#endif
diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h
index de3f40e2814b..e87aedf31179 100644
--- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h
+++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h
@@ -19,6 +19,8 @@
* along with this program. If not, see .
*
*/
+#pragma once
+
/**
* DWIN general defines and data structs for PRO UI
* Author: Miguel A. Risco-Castillo (MRISCOC)
@@ -26,8 +28,6 @@
* Date: 2022/08/08
*/
-#pragma once
-
//#define DEBUG_DWIN 1
//#define NEED_HEX_PRINT 1
diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h
index 55345a789985..85d969043f02 100644
--- a/Marlin/src/lcd/e3v2/proui/dwinui.h
+++ b/Marlin/src/lcd/e3v2/proui/dwinui.h
@@ -19,6 +19,7 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
* DWIN Enhanced implementation for PRO UI
@@ -27,8 +28,6 @@
* Date: 2022/07/05
*/
-#pragma once
-
#include "../../../inc/MarlinConfigPre.h"
#include "../common/dwin_set.h"
@@ -147,6 +146,13 @@
#define ICON_CaseLight ICON_Motion
#define ICON_LedControl ICON_Motion
+// MPC
+#define ICON_MPCNozzle ICON_SetEndTemp
+#define ICON_MPCValue ICON_Contact
+#define ICON_MPCHeater ICON_Temperature
+#define ICON_MPCHeatCap ICON_SetBedTemp
+#define ICON_MPCFan ICON_FanSpeed
+
// Buttons
#define BTN_Continue 85
#define BTN_Cancel 87
diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
index 6411b669bbc8..bc489dd1fa8f 100644
--- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
+++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
@@ -21,25 +21,10 @@
*/
/**
- * DWIN g-code thumbnail preview
+ * DWIN G-code thumbnail preview
* Author: Miguel A. Risco-Castillo
* version: 3.1.2
* Date: 2022/09/03
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * For commercial applications additional licenses can be requested
*/
#include "../../../inc/MarlinConfigPre.h"
diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.h b/Marlin/src/lcd/e3v2/proui/gcode_preview.h
index c1949c5abc12..2452797d0c62 100644
--- a/Marlin/src/lcd/e3v2/proui/gcode_preview.h
+++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.h
@@ -1,12 +1,13 @@
/**
- * DWIN g-code thumbnail preview
- * Author: Miguel A. Risco-Castillo
- * version: 3.1.2
- * Date: 2022/09/03
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -14,14 +15,19 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public License
+ * You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
- * For commercial applications additional licenses can be requested
*/
-
#pragma once
+/**
+ * DWIN G-code thumbnail preview
+ * Author: Miguel A. Risco-Castillo
+ * version: 3.1.2
+ * Date: 2022/09/03
+ */
+
void Preview_DrawFromSD();
void Preview_Invalidate();
bool Preview_Valid();
diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp
index 540f9e1f417b..dfcfaa7bbc19 100644
--- a/Marlin/src/lcd/e3v2/proui/menus.cpp
+++ b/Marlin/src/lcd/e3v2/proui/menus.cpp
@@ -25,20 +25,6 @@
* Author: Miguel A. Risco-Castillo
* Version: 1.9.1
* Date: 2022/12/02
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
*/
#include "../../../inc/MarlinConfigPre.h"
diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h
index 33712f8959ef..072bf7584d90 100644
--- a/Marlin/src/lcd/e3v2/proui/menus.h
+++ b/Marlin/src/lcd/e3v2/proui/menus.h
@@ -19,28 +19,14 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
* Menu functions for ProUI
* Author: Miguel A. Risco-Castillo
* Version: 1.9.1
* Date: 2022/12/02
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
*/
-#pragma once
#include "dwinui.h"
diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp
index 53178e3ea705..fddaf3963ae1 100644
--- a/Marlin/src/lcd/e3v2/proui/plot.cpp
+++ b/Marlin/src/lcd/e3v2/proui/plot.cpp
@@ -25,26 +25,11 @@
* Author: Miguel A. Risco-Castillo
* Version: 2.1.2
* Date: 2022/11/20
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * For commercial applications additional licenses can be requested
*/
-#include "../../../inc/MarlinConfigPre.h"
+#include "../../../inc/MarlinConfig.h"
-#if BOTH(DWIN_LCD_PROUI, HAS_PIDPLOT)
+#if BOTH(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH)
#include "plot.h"
#include "../../../core/types.h"
@@ -55,13 +40,13 @@
#define Plot_Bg_Color RGB( 1, 12, 8)
-PlotClass Plot;
+PlotClass plot;
uint16_t grphpoints, r, x2, y2 = 0;
frame_rect_t grphframe = {0};
float scale = 0;
-void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) {
+void PlotClass::Draw(const frame_rect_t &frame, const celsius_t max, const_float_t ref/*=0*/) {
grphframe = frame;
grphpoints = 0;
scale = frame.h / max;
@@ -76,7 +61,7 @@ void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref)
void PlotClass::Update(const_float_t value) {
if (!scale) return;
- uint16_t y = round((y2) - value * scale);
+ const uint16_t y = round((y2) - value * scale);
if (grphpoints < grphframe.w) {
DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y);
}
@@ -89,4 +74,4 @@ void PlotClass::Update(const_float_t value) {
grphpoints++;
}
-#endif // DWIN_LCD_PROUI && HAS_PIDPLOT
+#endif // DWIN_LCD_PROUI && SHOW_TUNING_GRAPH
diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h
index 2663776dc4fc..14e7058b0171 100644
--- a/Marlin/src/lcd/e3v2/proui/plot.h
+++ b/Marlin/src/lcd/e3v2/proui/plot.h
@@ -19,36 +19,21 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
* DWIN Single var plot
* Author: Miguel A. Risco-Castillo
* Version: 2.1.2
* Date: 2022/11/20
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see .
- *
- * For commercial applications additional licenses can be requested
*/
-#pragma once
#include "dwinui.h"
class PlotClass {
public:
- void Draw(frame_rect_t frame, float max, float ref = 0);
- void Update(const_float_t value);
+ static void Draw(const frame_rect_t &frame, const celsius_t max, const_float_t ref=0);
+ static void Update(const_float_t value);
};
-extern PlotClass Plot;
+extern PlotClass plot;
diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h
index 8352ef888622..425c948dbe39 100644
--- a/Marlin/src/lcd/language/language_en.h
+++ b/Marlin/src/lcd/language/language_en.h
@@ -376,10 +376,15 @@ namespace Language_en {
LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Cooling to ambient");
LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune");
LSTR MSG_MPC_EDIT = _UxGT("Edit * MPC");
+ LSTR MSG_MPC_POWER = _UxGT("Heater Power");
LSTR MSG_MPC_POWER_E = _UxGT("Power *");
+ LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Heat Capacity");
LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Heat Cap. *");
+ LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Sensor Resp.");
LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Sensor Resp. *");
+ LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Ambient Coeff.");
LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient Co. *");
+ LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Fan coeff.");
LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Fan coeff. *");
LSTR MSG_SELECT_E = _UxGT("Select *");
LSTR MSG_ACC = _UxGT("Accel");
diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp
index a4f528a4c819..99d5603566b6 100644
--- a/Marlin/src/module/temperature.cpp
+++ b/Marlin/src/module/temperature.cpp
@@ -903,6 +903,7 @@ volatile bool Temperature::raw_temps_ready = false;
if (!wait_for_heatup) {
SERIAL_ECHOPGM(STR_MPC_AUTOTUNE);
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);
+ TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED));
return false;
}
@@ -942,7 +943,12 @@ volatile bool Temperature::raw_temps_ready = false;
do_blocking_move_to(xyz_pos_t(MPC_TUNING_POS));
SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT);
- LCD_MESSAGE(MSG_COOLING);
+ #if ENABLED(DWIN_LCD_PROUI)
+ DWIN_MPCTuning(MPCTEMP_START);
+ LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT);
+ #else
+ LCD_MESSAGE(MSG_COOLING);
+ #endif
millis_t ms = millis(), next_report_ms = ms, next_test_ms = ms + 10000UL;
celsius_float_t current_temp = degHotend(active_extruder),
@@ -1063,6 +1069,7 @@ volatile bool Temperature::raw_temps_ready = false;
if (!WITHIN(current_temp, t3 - 15.0f, hotend.target + 15.0f)) {
SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR);
+ TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR));
break;
}
}
@@ -1084,6 +1091,7 @@ volatile bool Temperature::raw_temps_ready = false;
SERIAL_ECHOPGM(STR_MPC_AUTOTUNE);
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED);
+ TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE));
#if 0
SERIAL_ECHOLNPGM("t1_time ", t1_time);
diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality
index a3c52372ef37..8c0a40d8ae22 100755
--- a/buildroot/tests/STM32F103RE_creality
+++ b/buildroot/tests/STM32F103RE_creality
@@ -25,7 +25,11 @@ opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU SET_PROGRESS_MANUALLY S
BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \
LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE
opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128
-exec_test $1 $2 "Ender-3 S1 with ProUI" "$3"
+exec_test $1 $2 "Ender-3 S1 with ProUI (PIDTEMP)" "$3"
+
+opt_disable PIDTEMP
+opt_enable MPCTEMP
+exec_test $1 $2 "Ender-3 S1 with ProUI (MPCTEMP)" "$3"
restore_configs
opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1