Skip to content

Commit 7c52be8

Browse files
mriscocAndy-Big
authored andcommitted
🚸 Update DWIN ProUI (MarlinFirmware#26003)
1 parent 98adfee commit 7c52be8

35 files changed

+1212
-905
lines changed

Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,14 @@ void unified_bed_leveling::G29() {
310310
// Check for commands that require the printer to be homed
311311
if (may_move) {
312312
planner.synchronize();
313-
// Send 'N' to force homing before G29 (internal only)
314-
if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
313+
#if ALL(DWIN_LCD_PROUI, ZHOME_BEFORE_LEVELING)
314+
save_ubl_active_state_and_disable();
315+
gcode.process_subcommands_now(F("G28Z"));
316+
restore_ubl_active_state_and_leave();
317+
#else
318+
// Send 'N' to force homing before G29 (internal only)
319+
if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
320+
#endif
315321
probe.use_probing_tool();
316322

317323
// Position bed horizontally and Z probe vertically.

Marlin/src/feature/tmc_util.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
144144
#endif
145145
#endif
146146

147-
#if HAS_MARLINUI_MENU
147+
#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
148148
void refresh_stepper_current() { rms_current(this->val_mA); }
149149

150150
#if ENABLED(HYBRID_THRESHOLD)
@@ -207,7 +207,7 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
207207
}
208208
#endif
209209

210-
#if HAS_MARLINUI_MENU
210+
#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
211211
void refresh_stepper_current() { rms_current(this->val_mA); }
212212

213213
#if ENABLED(HYBRID_THRESHOLD)
@@ -269,7 +269,7 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
269269
}
270270
#endif
271271

272-
#if HAS_MARLINUI_MENU
272+
#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
273273
void refresh_stepper_current() { rms_current(this->val_mA); }
274274

275275
#if ENABLED(HYBRID_THRESHOLD)
@@ -315,7 +315,7 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
315315
}
316316
#endif
317317

318-
#if HAS_MARLINUI_MENU
318+
#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
319319
void refresh_stepper_current() { rms_current(this->val_mA); }
320320

321321
#if USE_SENSORLESS

Marlin/src/gcode/lcd/M73.cpp

+12-20
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,20 @@
5050
*/
5151
void GcodeSuite::M73() {
5252

53-
#if ENABLED(DWIN_LCD_PROUI)
54-
55-
DWIN_M73();
56-
57-
#else
58-
59-
#if ENABLED(SET_PROGRESS_PERCENT)
60-
if (parser.seenval('P'))
61-
ui.set_progress((PROGRESS_SCALE) > 1
62-
? parser.value_float() * (PROGRESS_SCALE)
63-
: parser.value_byte()
64-
);
65-
#endif
66-
67-
#if ENABLED(SET_REMAINING_TIME)
68-
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
69-
#endif
53+
#if ENABLED(SET_PROGRESS_PERCENT)
54+
if (parser.seenval('P'))
55+
ui.set_progress((PROGRESS_SCALE) > 1
56+
? parser.value_float() * (PROGRESS_SCALE)
57+
: parser.value_byte()
58+
);
59+
#endif
7060

71-
#if ENABLED(SET_INTERACTION_TIME)
72-
if (parser.seenval('C')) ui.set_interaction_time(60 * parser.value_ulong());
73-
#endif
61+
#if ENABLED(SET_REMAINING_TIME)
62+
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
63+
#endif
7464

65+
#if ENABLED(SET_INTERACTION_TIME)
66+
if (parser.seenval('C')) ui.set_interaction_time(60 * parser.value_ulong());
7567
#endif
7668

7769
#if ENABLED(M73_REPORT)

Marlin/src/gcode/probe/G30.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void GcodeSuite::G30() {
7171

7272
remember_feedrate_scaling_off();
7373

74-
TERN_(DWIN_CREALITY_LCD_JYERSUI, process_subcommands_now(F("G28O")));
74+
#if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
75+
process_subcommands_now(F("G28O"));
76+
#endif
7577

7678
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
7779

Marlin/src/inc/SanityCheck.h

+10-6
Original file line numberDiff line numberDiff line change
@@ -2715,14 +2715,18 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
27152715
#elif ENABLED(DWIN_LCD_PROUI)
27162716
#if !HAS_MEDIA
27172717
#error "DWIN_LCD_PROUI requires SDSUPPORT to be enabled."
2718-
#elif ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU)
2719-
#error "DWIN_LCD_PROUI does not support PID_EDIT_MENU or PID_AUTOTUNE_MENU."
2720-
#elif ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU)
2721-
#error "DWIN_LCD_PROUI does not support MPC_EDIT_MENU or MPC_AUTOTUNE_MENU."
2722-
#elif ENABLED(LCD_BED_TRAMMING)
2723-
#error "DWIN_LCD_PROUI does not support LCD_BED_TRAMMING."
27242718
#elif ALL(LCD_BED_LEVELING, PROBE_MANUALLY)
27252719
#error "DWIN_LCD_PROUI does not support LCD_BED_LEVELING with PROBE_MANUALLY."
2720+
#elif ENABLED(MEDIASORT_MENU_ITEM) && DISABLED(SDCARD_SORT_ALPHA)
2721+
#error "MEDIASORT_MENU_ITEM requires SDCARD_SORT_ALPHA."
2722+
#elif ENABLED(RUNOUT_TUNE_ITEM) && DISABLED(HAS_FILAMENT_SENSOR)
2723+
#error "RUNOUT_TUNE_ITEM requires HAS_FILAMENT_SENSOR."
2724+
#elif ENABLED(PLR_TUNE_ITEM) && DISABLED(POWER_LOSS_RECOVERY)
2725+
#error "PLR_TUNE_ITEM requires POWER_LOSS_RECOVERY."
2726+
#elif ENABLED(JD_TUNE_ITEM) && DISABLED(HAS_JUNCTION_DEVIATION)
2727+
#error "JD_TUNE_ITEM requires HAS_JUNCTION_DEVIATION."
2728+
#elif ENABLED(ADVK_TUNE_ITEM) && DISABLED(LIN_ADVANCE)
2729+
#error "ADVK_TUNE_ITEM requires LIN_ADVANCE."
27262730
#endif
27272731
#endif
27282732

Marlin/src/lcd/e3v2/common/dwin_font.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ typedef uint8_t fontid_t;
2828
* 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
2929
* 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
3030
*/
31-
#define font6x12 0x00
31+
#if DISABLED(TJC_DISPLAY)
32+
#define font6x12 0x00
33+
#define font20x40 0x06
34+
#define font24x48 0x07
35+
#define font28x56 0x08
36+
#define font32x64 0x09
37+
#endif
3238
#define font8x16 0x01
3339
#define font10x20 0x02
3440
#define font12x24 0x03
3541
#define font14x28 0x04
3642
#define font16x32 0x05
37-
#define font20x40 0x06
38-
#define font24x48 0x07
39-
#define font28x56 0x08
40-
#define font32x64 0x09

Marlin/src/lcd/e3v2/common/limits.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,10 @@ constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_A
9191

9292
constexpr xyze_float_t min_steps_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_STEPS_EDIT_VALUE),
9393
default_steps = DEFAULT_AXIS_STEPS_PER_UNIT,
94-
max_steps_edit_values = default_steps * float(DEFAULT_MAX_MULTIPLIER);
94+
max_steps_edit_values =
95+
#ifdef MAX_STEPS_EDIT_VALUES
96+
MAX_STEPS_EDIT_VALUES
97+
#else
98+
default_steps * float(DEFAULT_MAX_MULTIPLIER)
99+
#endif
100+
;

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

+25-17
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/**
2424
* Bed Level Tools for Pro UI
2525
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
26-
* Version: 2.1.0
27-
* Date: 2022/08/27
26+
* Version: 3.2.0
27+
* Date: 2023/05/03
2828
*
2929
* Based on the original work of: Henri-J-Norden
3030
* https://github.com/Jyers/Marlin/pull/126
@@ -65,7 +65,7 @@
6565

6666
BedLevelToolsClass bedLevelTools;
6767

68-
#if ENABLED(USE_UBL_VIEWER)
68+
#if ENABLED(USE_GRID_MESHVIEWER)
6969
bool BedLevelToolsClass::viewer_asymmetric_range = false;
7070
bool BedLevelToolsClass::viewer_print_value = false;
7171
#endif
@@ -170,15 +170,20 @@ void BedLevelToolsClass::MoveToZ() {
170170
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true);
171171
}
172172
void BedLevelToolsClass::ProbeXY() {
173-
const uint16_t Clear = Z_CLEARANCE_DEPLOY_PROBE;
174-
sprintf_P(cmd, PSTR("G28O\nG0Z%i\nG30X%sY%s"),
175-
Clear,
173+
const uint16_t zclear = Z_CLEARANCE_DEPLOY_PROBE;
174+
sprintf_P(cmd, PSTR("G0Z%i\nG30X%sY%s"),
175+
zclear,
176176
dtostrf(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 1, 2, str_1),
177177
dtostrf(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 1, 2, str_2)
178178
);
179179
gcode.process_subcommands_now(cmd);
180180
}
181181

182+
void BedLevelToolsClass::mesh_reset() {
183+
ZERO(bedlevel.z_values);
184+
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level());
185+
}
186+
182187
// Accessors
183188
float BedLevelToolsClass::get_max_value() {
184189
float max = __FLT_MAX__ * -1;
@@ -207,9 +212,11 @@ bool BedLevelToolsClass::meshvalidate() {
207212
return true;
208213
}
209214

210-
#if ENABLED(USE_UBL_VIEWER)
215+
#if ENABLED(USE_GRID_MESHVIEWER)
216+
217+
constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
211218

212-
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*/) {
219+
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)*/) {
213220
drawing_mesh = true;
214221
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
215222
const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X);
@@ -227,7 +234,6 @@ bool BedLevelToolsClass::meshvalidate() {
227234
}
228235

229236
// Draw value square grid
230-
char buf[8];
231237
GRID_LOOP(x, y) {
232238
const auto start_x_px = padding_x + x * cell_width_px;
233239
const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width;
@@ -246,20 +252,22 @@ bool BedLevelToolsClass::meshvalidate() {
246252
LCD_SERIAL.flushTX();
247253

248254
// Draw value text on
255+
char buf[8];
256+
const uint8_t fs = DWINUI::fontWidth(meshfont);
249257
if (viewer_print_value) {
250-
int8_t offset_x, offset_y = cell_height_px / 2 - 6;
258+
int8_t offset_x, offset_y = cell_height_px / 2 - fs;
251259
if (isnan(bedlevel.z_values[x][y])) { // undefined
252-
dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X"));
260+
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X"));
253261
}
254262
else { // has value
255-
if (GRID_MAX_POINTS_X < 10)
263+
if (GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10))
256264
sprintf_P(buf, PSTR("%s"), dtostrf(abs(bedlevel.z_values[x][y]), 1, 2, str_1));
257265
else
258266
sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100));
259-
offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2;
260-
if (!(GRID_MAX_POINTS_X < 10))
261-
dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F("."));
262-
dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf);
267+
offset_x = cell_width_px / 2 - (fs/2) * (strlen(buf)) - 2;
268+
if (!(GRID_MAX_POINTS_X < (ENABLED(TJC_DISPLAY) ? 8 : 10)))
269+
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y, F("."));
270+
dwinDrawString(false, meshfont, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y, buf);
263271
}
264272
safe_delay(10);
265273
LCD_SERIAL.flushTX();
@@ -286,6 +294,6 @@ bool BedLevelToolsClass::meshvalidate() {
286294
drawing_mesh = false;
287295
}
288296

289-
#endif // USE_UBL_VIEWER
297+
#endif // USE_GRID_MESHVIEWER
290298

291299
#endif // DWIN_LCD_PROUI && HAS_LEVELING

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/**
2424
* Bed Level Tools for Pro UI
2525
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
26-
* Version: 2.1.0
27-
* Date: 2022/08/27
26+
* Version: 3.2.0
27+
* Date: 2023/05/03
2828
*
2929
* Based on the original work of: Henri-J-Norden
3030
* https://github.com/Jyers/Marlin/pull/126
@@ -47,14 +47,12 @@
4747

4848
#include "../../../inc/MarlinConfigPre.h"
4949

50-
//#define USE_UBL_VIEWER 1
51-
5250
#define UBL_Z_OFFSET_MIN -3.0
5351
#define UBL_Z_OFFSET_MAX 3.0
5452

5553
class BedLevelToolsClass {
5654
public:
57-
#if ENABLED(USE_UBL_VIEWER)
55+
#if ENABLED(USE_GRID_MESHVIEWER)
5856
static bool viewer_asymmetric_range;
5957
static bool viewer_print_value;
6058
#endif
@@ -74,11 +72,12 @@ class BedLevelToolsClass {
7472
static void MoveToXY();
7573
static void MoveToZ();
7674
static void ProbeXY();
75+
static void mesh_reset();
7776
static float get_max_value();
7877
static float get_min_value();
7978
static bool meshvalidate();
80-
#if ENABLED(USE_UBL_VIEWER)
81-
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);
79+
#if ENABLED(USE_GRID_MESHVIEWER)
80+
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));
8281
static void Set_Mesh_Viewer_Status();
8382
#endif
8483
};

0 commit comments

Comments
 (0)