Skip to content

Commit a0e5682

Browse files
mriscocAndy-Big
authored andcommittedJul 2, 2023
🚸 ProUI updates (MarlinFirmware#25176)
1 parent a9d6224 commit a0e5682

36 files changed

+1290
-1377
lines changed
 

‎Marlin/src/feature/pause.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
415415
#endif
416416

417417
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
418-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
419418

420419
// Indicate that the printer is paused
421420
++did_pause_print;
@@ -466,6 +465,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
466465

467466
// If axes don't need to home then the nozzle can park
468467
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
468+
TERN_(DWIN_LCD_PROUI, if (!do_park) ui.set_status(GET_TEXT_F(MSG_PARK_FAILED)));
469469

470470
#if ENABLED(DUAL_X_CARRIAGE)
471471
const int8_t saved_ext = active_extruder;
@@ -715,13 +715,8 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
715715

716716
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
717717

718-
#if ENABLED(DWIN_LCD_PROUI)
719-
DWIN_Print_Resume();
720-
HMI_ReturnScreen();
721-
#else
722-
ui.reset_status();
723-
ui.return_to_status();
724-
#endif
718+
ui.reset_status();
719+
ui.return_to_status();
725720
}
726721

727722
#endif // ADVANCED_PAUSE_FEATURE

‎Marlin/src/gcode/config/M302.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "../../module/temperature.h"
2929

3030
#if ENABLED(DWIN_LCD_PROUI)
31-
#include "../../lcd/e3v2/proui/dwin_defines.h"
31+
#include "../../lcd/e3v2/proui/dwin.h"
3232
#endif
3333

3434
/**

‎Marlin/src/gcode/lcd/M145.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void GcodeSuite::M145() {
4747
preheat_t &mat = ui.material_preset[material];
4848
#if HAS_HOTEND
4949
if (parser.seenval('H'))
50-
mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
50+
mat.hotend_temp = constrain(parser.value_int(), thermalManager.extrude_min_temp, thermalManager.hotend_max_target(0));
5151
#endif
5252
#if HAS_HEATED_BED
5353
if (parser.seenval('B'))

‎Marlin/src/gcode/sd/M1001.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ void GcodeSuite::M1001() {
115115
#endif
116116

117117
TERN_(EXTENSIBLE_UI, ExtUI::onPrintDone());
118-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
119118

120119
// Re-select the last printed file in the UI
121120
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());

‎Marlin/src/gcode/sd/M524.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "../../sd/cardreader.h"
2929

3030
#if ENABLED(DWIN_LCD_PROUI)
31-
#include "../../lcd/e3v2/proui/dwin.h"
31+
#include "../../lcd/marlinui.h"
3232
#endif
3333

3434
/**
@@ -38,7 +38,7 @@ void GcodeSuite::M524() {
3838

3939
#if ENABLED(DWIN_LCD_PROUI)
4040

41-
HMI_flag.abort_flag = true; // The LCD will handle it
41+
ui.abort_print();
4242

4343
#else
4444

‎Marlin/src/gcode/stats/M75-M78.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
void GcodeSuite::M75() {
4040
startOrResumeJob();
4141
#if ENABLED(DWIN_LCD_PROUI)
42-
DWIN_Print_Started(false);
4342
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
4443
#endif
4544
}
@@ -48,17 +47,15 @@ void GcodeSuite::M75() {
4847
* M76: Pause print timer
4948
*/
5049
void GcodeSuite::M76() {
51-
print_job_timer.pause();
50+
TERN(DWIN_LCD_PROUI, ui.pause_print(), print_job_timer.pause());
5251
TERN_(HOST_PAUSE_M76, hostui.pause());
53-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
5452
}
5553

5654
/**
5755
* M77: Stop print timer
5856
*/
5957
void GcodeSuite::M77() {
6058
print_job_timer.stop();
61-
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
6259
}
6360

6461
#if ENABLED(PRINTCOUNTER)

‎Marlin/src/gcode/temp/M303.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void GcodeSuite::M303() {
8686

8787
#if ENABLED(DWIN_LCD_PROUI)
8888
if (seenC) HMI_data.PidCycles = c;
89-
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else HMI_data.HotendPidT = temp; }
89+
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else TERN_(PIDTEMP, HMI_data.HotendPidT = temp); }
9090
#endif
9191

9292
#if DISABLED(BUSY_WHILE_HEATING)

‎Marlin/src/inc/Conditionals_post.h

+1
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,7 @@
24722472
#define BED_MAX_TARGET (BED_MAXTEMP - (BED_OVERSHOOT))
24732473
#else
24742474
#undef PIDTEMPBED
2475+
#undef PREHEAT_BEFORE_LEVELING
24752476
#endif
24762477

24772478
#if HAS_TEMP_COOLER && PIN_EXISTS(COOLER)

‎Marlin/src/inc/SanityCheck.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
940940
#error "SD_REPRINT_LAST_SELECTED_FILE currently requires a Marlin-native LCD menu."
941941
#endif
942942

943-
#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, EXTENSIBLE_UI) && !defined(MANUAL_FEEDRATE)
944-
#error "MANUAL_FEEDRATE is required for MarlinUI, ExtUI, or FTDI EVE Touch UI."
943+
#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, EXTENSIBLE_UI, DWIN_LCD_PROUI) && !defined(MANUAL_FEEDRATE)
944+
#error "MANUAL_FEEDRATE is required for ProUI, MarlinUI, ExtUI, or FTDI EVE Touch UI."
945945
#endif
946946

947947
/**

‎Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp

+43-26
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,37 @@
1919
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2020
*
2121
*/
22-
22+
2323
/**
2424
* Bed Level Tools for Pro UI
2525
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
26-
* Version: 2.0.0
27-
* Date: 2022/05/23
28-
*
26+
* Version: 2.1.0
27+
* Date: 2022/08/27
28+
*
2929
* Based on the original work of: Henri-J-Norden
3030
* https://github.com/Jyers/Marlin/pull/126
31+
*
32+
* This program is free software: you can redistribute it and/or modify
33+
* it under the terms of the GNU General Public License as published by
34+
* the Free Software Foundation, either version 3 of the License, or
35+
* (at your option) any later version.
36+
*
37+
* This program is distributed in the hope that it will be useful,
38+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
39+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+
* GNU General Public License for more details.
41+
*
42+
* You should have received a copy of the GNU General Public License
43+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
44+
*
3145
*/
3246

3347
#include "../../../inc/MarlinConfigPre.h"
34-
#include "bedlevel_tools.h"
3548

3649
#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING)
3750

3851
#include "../../marlinui.h"
3952
#include "../../../core/types.h"
40-
#include "dwin.h"
41-
#include "dwinui.h"
42-
#include "dwin_popup.h"
4353
#include "../../../feature/bedlevel/bedlevel.h"
4454
#include "../../../module/probe.h"
4555
#include "../../../gcode/gcode.h"
@@ -48,9 +58,14 @@
4858
#include "../../../libs/least_squares_fit.h"
4959
#include "../../../libs/vector_3.h"
5060

51-
BedLevelToolsClass BedLevelTools;
61+
#include "dwin.h"
62+
#include "dwinui.h"
63+
#include "dwin_popup.h"
64+
#include "bedlevel_tools.h"
65+
66+
BedLevelToolsClass bedLevelTools;
5267

53-
#if USE_UBL_VIEWER
68+
#if ENABLED(USE_UBL_VIEWER)
5469
bool BedLevelToolsClass::viewer_asymmetric_range = false;
5570
bool BedLevelToolsClass::viewer_print_value = false;
5671
#endif
@@ -153,26 +168,30 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y,
153168
}
154169
}
155170

171+
// Move / Probe methods. As examples, not yet used.
156172
void BedLevelToolsClass::MoveToXYZ() {
157-
BedLevelTools.goto_mesh_value = true;
158-
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
173+
bedLevelTools.goto_mesh_value = true;
174+
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
159175
}
160176
void BedLevelToolsClass::MoveToXY() {
161-
BedLevelTools.goto_mesh_value = false;
162-
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
177+
bedLevelTools.goto_mesh_value = false;
178+
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
163179
}
164180
void BedLevelToolsClass::MoveToZ() {
165-
BedLevelTools.goto_mesh_value = true;
166-
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, true);
181+
bedLevelTools.goto_mesh_value = true;
182+
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true);
167183
}
168184
void BedLevelToolsClass::ProbeXY() {
169-
sprintf_P(cmd, PSTR("G30X%sY%s"),
170-
dtostrf(bedlevel.get_mesh_x(BedLevelTools.mesh_x), 1, 2, str_1),
171-
dtostrf(bedlevel.get_mesh_y(BedLevelTools.mesh_y), 1, 2, str_2)
185+
const uint16_t Clear = Z_CLEARANCE_DEPLOY_PROBE;
186+
sprintf_P(cmd, PSTR("G0Z%i\nG30X%sY%s"),
187+
Clear,
188+
dtostrf(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 1, 2, str_1),
189+
dtostrf(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 1, 2, str_2)
172190
);
173191
gcode.process_subcommands_now(cmd);
174192
}
175193

194+
// Accessors
176195
float BedLevelToolsClass::get_max_value() {
177196
float max = __FLT_MAX__ * -1;
178197
GRID_LOOP(x, y) {
@@ -191,18 +210,16 @@ float BedLevelToolsClass::get_min_value() {
191210
return min;
192211
}
193212

213+
// Return 'true' if mesh is good and within LCD limits
194214
bool BedLevelToolsClass::meshvalidate() {
195-
float min = __FLT_MAX__, max = __FLT_MAX__ * -1;
196-
197215
GRID_LOOP(x, y) {
198-
if (isnan(bedlevel.z_values[x][y])) return false;
199-
if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y];
200-
if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y];
216+
const float v = bedlevel.z_values[x][y];
217+
if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false;
201218
}
202-
return WITHIN(max, MESH_Z_OFFSET_MIN, MESH_Z_OFFSET_MAX);
219+
return true;
203220
}
204221

205-
#if USE_UBL_VIEWER
222+
#if ENABLED(USE_UBL_VIEWER)
206223

207224
void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) {
208225
drawing_mesh = true;

‎Marlin/src/lcd/e3v2/proui/bedlevel_tools.h

+23-14
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,38 @@
2323
/**
2424
* Bed Level Tools for Pro UI
2525
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
26-
* Version: 2.0.0
27-
* Date: 2022/05/23
28-
*
26+
* Version: 2.1.0
27+
* Date: 2022/08/27
28+
*
2929
* Based on the original work of: Henri-J-Norden
3030
* https://github.com/Jyers/Marlin/pull/126
31+
*
32+
* This program is free software: you can redistribute it and/or modify
33+
* it under the terms of the GNU General Public License as published by
34+
* the Free Software Foundation, either version 3 of the License, or
35+
* (at your option) any later version.
36+
*
37+
* This program is distributed in the hope that it will be useful,
38+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
39+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+
* GNU General Public License for more details.
41+
*
42+
* You should have received a copy of the GNU General Public License
43+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
44+
*
3145
*/
32-
3346
#pragma once
3447

3548
#include "../../../inc/MarlinConfigPre.h"
3649

37-
#if ENABLED(AUTO_BED_LEVELING_UBL)
38-
//#define USE_UBL_VIEWER 1
39-
#endif
50+
//#define USE_UBL_VIEWER 1
4051

41-
#define MESH_Z_OFFSET_MIN -3.0
42-
#define MESH_Z_OFFSET_MAX 3.0
52+
#define UBL_Z_OFFSET_MIN -3.0
53+
#define UBL_Z_OFFSET_MAX 3.0
4354

4455
class BedLevelToolsClass {
4556
public:
46-
#if USE_UBL_VIEWER
57+
#if ENABLED(USE_UBL_VIEWER)
4758
static bool viewer_asymmetric_range;
4859
static bool viewer_print_value;
4960
#endif
@@ -66,12 +77,10 @@ class BedLevelToolsClass {
6677
static float get_max_value();
6778
static float get_min_value();
6879
static bool meshvalidate();
69-
#if USE_UBL_VIEWER
80+
#if ENABLED(USE_UBL_VIEWER)
7081
static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
7182
static void Set_Mesh_Viewer_Status();
7283
#endif
7384
};
7485

75-
extern BedLevelToolsClass BedLevelTools;
76-
77-
void Goto_MeshViewer();
86+
extern BedLevelToolsClass bedLevelTools;

0 commit comments

Comments
 (0)
Please sign in to comment.