Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extra ProUI features #26761

Open
wants to merge 61 commits into
base: bugfix-2.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
1129b71
add Cancel ABL, other abl fixes
classicrocker883 Jan 31, 2024
2f1929b
add EXIT_PROBE_MESH
classicrocker883 Feb 1, 2024
87ed27a
fixes for dwin
classicrocker883 Feb 1, 2024
d0e400e
fixes for dwin, add probe_offset to G29
classicrocker883 Feb 2, 2024
2266b79
remove homeZ
classicrocker883 Feb 3, 2024
bb89c67
add multipleProbing
classicrocker883 Feb 3, 2024
059b9b4
revert menus.cpp ^= true, save for other PR
classicrocker883 Feb 3, 2024
6242d1d
add zprobeFeed(rate) feature
classicrocker883 Feb 3, 2024
0ae89c0
update menu options
classicrocker883 Feb 3, 2024
c535a9b
add variable Mesh_Inset
classicrocker883 Feb 4, 2024
bed57fe
add another run_z_probe function for testing
classicrocker883 Feb 4, 2024
8a671ee
update meshinset
classicrocker883 Feb 4, 2024
396bb6c
add GRID points
classicrocker883 Feb 5, 2024
c47cfe4
add grid points (UBL)
classicrocker883 Feb 5, 2024
de13f6d
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Feb 6, 2024
9506730
update for Bilinear + UBL, kinda for MBL (needs more testing)
classicrocker883 Feb 7, 2024
ee716be
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Feb 7, 2024
581803b
couple tweaks
classicrocker883 Feb 7, 2024
70e9ed7
update drawmeshpoints
classicrocker883 Feb 8, 2024
ef22fec
update fix for Mesh bed leveling + the others
classicrocker883 Feb 8, 2024
9aa0573
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Feb 8, 2024
bca866a
update run_z_probe
classicrocker883 Feb 9, 2024
ef01edf
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Feb 9, 2024
c5d7e68
move resetMesh
classicrocker883 Feb 10, 2024
7930249
update settings.cpp gridpoints
classicrocker883 Feb 11, 2024
dc1d4e7
add tram() exclusion
classicrocker883 Feb 15, 2024
0702de9
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Feb 18, 2024
6b719b8
tweak - remove unused
classicrocker883 Feb 19, 2024
859746c
typo
classicrocker883 Feb 21, 2024
038b1db
grid_loop test (warning)
classicrocker883 Feb 21, 2024
114fad2
revert back (test), typos
classicrocker883 Feb 21, 2024
6e5cfd3
adjust ubl_G29 for narrowing conv.
classicrocker883 Feb 29, 2024
f05713e
adjust ubl_G29 spacing
classicrocker883 Feb 29, 2024
cc67a8a
update dwin.cpp, rearrange menu items - add levelMenu
classicrocker883 Mar 14, 2024
ea12b4f
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Mar 14, 2024
4cee1c1
move hmiData to dwin_defines.h, tweak
classicrocker883 Apr 6, 2024
a0647e9
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Apr 14, 2024
ffa5c64
update - merge fixes
classicrocker883 Apr 14, 2024
d67a23f
fix a compile err
thinkyhead Apr 14, 2024
5a9961e
maybe fixes mesh_inset?
classicrocker883 Apr 15, 2024
1226dae
fix editable mesh_inset to work, update get_mesh_x/y()
classicrocker883 Apr 15, 2024
3244427
update gcode_preview to work better
classicrocker883 Apr 15, 2024
b21a8d8
call for ubl
thinkyhead Apr 16, 2024
953f6ba
remove PROUI_GRID_PNTS
classicrocker883 Apr 19, 2024
6039e2b
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Apr 23, 2024
04da879
update for ABL - Bilinear variable mesh_inset
classicrocker883 Apr 28, 2024
61a1d91
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 May 22, 2024
5b615f0
add mesh viewer to display_map
classicrocker883 May 22, 2024
580db49
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 May 28, 2024
a18ef72
revert settings.cpp
classicrocker883 May 28, 2024
f49ace9
remove comments motion.h
classicrocker883 May 28, 2024
e319336
revert some, change some
classicrocker883 May 28, 2024
41a7d62
revert ubl.cpp
classicrocker883 May 28, 2024
ef45055
update from other PR for here
classicrocker883 May 29, 2024
c42dbd7
update dwin.cpp - remove duplicate
classicrocker883 May 30, 2024
b3dcfcc
add missing declaration
classicrocker883 May 30, 2024
fb61d5c
adjust spacing, rearrange MESH_##_DIST
classicrocker883 Jun 1, 2024
f2afc3b
Merge https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x-Jan2
classicrocker883 Jun 27, 2024
7ce624d
Merge https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x-Jan2
classicrocker883 Jul 13, 2024
1f17c48
Merge https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x-Jan2
classicrocker883 Aug 2, 2024
1d505eb
Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marl…
classicrocker883 Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
#include "../../../lcd/extui/ui_api.h"
#endif

#if ENABLED(DWIN_LCD_PROUI)
#include "../../../lcd/e3v2/proui/meshviewer.h"
#endif

#if ENABLED(UBL_HILBERT_CURVE)
#include "../hilbert_curve.h"
#endif
Expand Down Expand Up @@ -768,7 +772,7 @@ void unified_bed_leveling::shift_mesh_height() {
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout());
TERN_(DWIN_LCD_PROUI, dwinRedrawScreen());
TERN_(DWIN_LCD_PROUI, if (!hmiFlag.cancel_lev) { dwinRedrawScreen(); } else { break; })

#if HAS_MARLINUI_MENU
if (ui.button_pressed()) {
Expand Down Expand Up @@ -799,11 +803,14 @@ void unified_bed_leveling::shift_mesh_height() {
ExtUI::onMeshUpdate(best.pos, ExtUI::G29_POINT_FINISH);
ExtUI::onMeshUpdate(best.pos, measured_z);
#endif
TERN_(DWIN_LCD_PROUI, meshViewer.drawMeshPoint(best.pos.x, best.pos.y, measured_z));
}
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.

} while (best.pos.x >= 0 && --count);

TERN_(DWIN_LCD_PROUI, if (hmiFlag.cancel_lev) { goto EXIT_PROBE_MESH; })

GRID_LOOP(x, y) if (z_values[x][y] == HUGE_VALF) z_values[x][y] = NAN; // Restore NAN for HUGE_VALF marks

TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::G29_FINISH));
Expand All @@ -813,7 +820,7 @@ void unified_bed_leveling::shift_mesh_height() {
probe.stow();
TERN_(HAS_MARLINUI_MENU, ui.capture());

probe.move_z_after_probing();
TERN_(Z_AFTER_PROBING, probe.move_z_after_probing());

restore_ubl_active_state_and_leave();

Expand All @@ -823,7 +830,7 @@ void unified_bed_leveling::shift_mesh_height() {
);

TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
TERN_(DWIN_LCD_PROUI, dwinLevelingDone());
TERN_(DWIN_LCD_PROUI, EXIT_PROBE_MESH: dwinLevelingDone());
}

#endif // HAS_BED_PROBE
Expand Down Expand Up @@ -1184,9 +1191,9 @@ bool unified_bed_leveling::G29_parse_parameters() {
}

param.XY_seen.x = parser.seenval('X');
float sx = param.XY_seen.x ? parser.value_float() : current_position.x;
float sx = param.XY_seen.x ? parser.value_float() : current_position.x - TERN0(HAS_BED_PROBE, probe.offset.x);
param.XY_seen.y = parser.seenval('Y');
float sy = param.XY_seen.y ? parser.value_float() : current_position.y;
float sy = param.XY_seen.y ? parser.value_float() : current_position.y - TERN0(HAS_BED_PROBE, probe.offset.y);

if (param.XY_seen.x != param.XY_seen.y) {
SERIAL_ECHOLNPGM("Both X & Y locations must be specified.\n");
Expand All @@ -1195,8 +1202,8 @@ bool unified_bed_leveling::G29_parse_parameters() {

// If X or Y are not valid, use center of the bed values
// (for UBL_HILBERT_CURVE default to lower-left corner instead)
if (!COORDINATE_OKAY(sx, X_MIN_BED, X_MAX_BED)) sx = TERN(UBL_HILBERT_CURVE, 0, X_CENTER);
if (!COORDINATE_OKAY(sy, Y_MIN_BED, Y_MAX_BED)) sy = TERN(UBL_HILBERT_CURVE, 0, Y_CENTER);
if (!COORDINATE_OKAY(sx, X_MIN_BED, X_MAX_BED)) sx = TERN(UBL_HILBERT_CURVE, 0, X_CENTER - TERN0(HAS_BED_PROBE, probe.offset.x));
if (!COORDINATE_OKAY(sy, Y_MIN_BED, Y_MAX_BED)) sy = TERN(UBL_HILBERT_CURVE, 0, Y_CENTER - TERN0(HAS_BED_PROBE, probe.offset.y));

if (err_flag) return UBL_ERR;

Expand Down Expand Up @@ -1442,10 +1449,10 @@ typedef struct { uint8_t sx, ex, sy, ey; bool yfirst; } smart_fill_info;

void unified_bed_leveling::smart_fill_mesh() {
static const smart_fill_info
info0 PROGMEM = { 0, GRID_MAX_POINTS_X, 0, (GRID_MAX_POINTS_Y) - 2, false }, // Bottom of the mesh looking up
info1 PROGMEM = { 0, GRID_MAX_POINTS_X, (GRID_MAX_POINTS_Y) - 1, 0, false }, // Top of the mesh looking down
info2 PROGMEM = { 0, (GRID_MAX_POINTS_X) - 2, 0, GRID_MAX_POINTS_Y, true }, // Left side of the mesh looking right
info3 PROGMEM = { (GRID_MAX_POINTS_X) - 1, 0, 0, GRID_MAX_POINTS_Y, true }; // Right side of the mesh looking left
info0 PROGMEM = { 0, GRID_MAX_POINTS_X, 0, (GRID_MAX_POINTS_Y) - 2, false }, // Bottom of the mesh looking up
info1 PROGMEM = { 0, GRID_MAX_POINTS_X, (GRID_MAX_POINTS_Y) - 1, 0, false }, // Top of the mesh looking down
info2 PROGMEM = { 0, (GRID_MAX_POINTS_X) - 2, 0, GRID_MAX_POINTS_Y, true }, // Left side of the mesh looking right
info3 PROGMEM = { (GRID_MAX_POINTS_X) - 1, 0, 0, GRID_MAX_POINTS_Y, true }; // Right side of the mesh looking left
static const smart_fill_info * const info[] PROGMEM = { &info0, &info1, &info2, &info3 };

for (uint8_t i = 0; i < COUNT(info); ++i) {
Expand Down Expand Up @@ -1513,7 +1520,7 @@ void unified_bed_leveling::smart_fill_mesh() {
}

probe.stow();
probe.move_z_after_probing();
TERN_(Z_AFTER_PROBING, probe.move_z_after_probing());

if (abort_flag) {
SERIAL_ECHOLNPGM("?Error probing point. Aborting operation.");
Expand Down Expand Up @@ -1599,7 +1606,7 @@ void unified_bed_leveling::smart_fill_mesh() {
}
}
probe.stow();
probe.move_z_after_probing();
TERN_(Z_AFTER_PROBING, probe.move_z_after_probing());

if (abort_flag || finish_incremental_LSF(&lsf_results)) {
SERIAL_ECHOLNPGM("Could not complete LSF!");
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ G29_TYPE GcodeSuite::G29() {

int8_t inStart, inStop, inInc;

TERN_(DWIN_LCD_PROUI, if (HMI_flag.cancel_lev) break);

if (zig) { // Zig away from origin
inStart = 0; // Left or front
inStop = PR_INNER_SIZE; // Right or back
Expand Down Expand Up @@ -780,6 +782,7 @@ G29_TYPE GcodeSuite::G29() {

abl.reenable = false; // Don't re-enable after modifying the mesh
idle_no_sleep();
TERN_(DWIN_LCD_PROUI, if (HMI_flag.cancel_lev) break);

} // inner
} // outer
Expand Down Expand Up @@ -985,7 +988,7 @@ G29_TYPE GcodeSuite::G29() {
// Restore state after probing
if (!faux) restore_feedrate_and_scaling();

TERN_(HAS_BED_PROBE, probe.move_z_after_probing());
TERN_(Z_AFTER_PROBING, probe.move_z_after_probing());

#ifdef EVENT_GCODE_AFTER_G29
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z Probe End Script: ", EVENT_GCODE_AFTER_G29);
Expand Down
62 changes: 42 additions & 20 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,11 @@ void hmiWaitForUser() {
if (!wait_for_user) {
switch (checkkey) {
case ID_PrintDone: select_page.reset(); gotoMainMenu(); break;
case ID_Leveling:
hmiFlag.cancel_lev = 1;
dwinDrawStatusLine("Canceling auto leveling...");
case ID_NothingToDo:
break;
default: hmiReturnScreen(); break;
}
}
Expand Down Expand Up @@ -1480,7 +1485,7 @@ void hmiReturnScreen() {

void dwinHomingStart() {
hmiFlag.home_flag = true;
hmiSaveProcessID(ID_Homing);
if (checkkey != ID_NothingToDo) { hmiSaveProcessID(ID_Homing); }
title.showCaption(GET_TEXT_F(MSG_HOMING));
dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
}
Expand All @@ -1489,16 +1494,26 @@ void dwinHomingDone() {
hmiFlag.home_flag = false;
if (last_checkkey == ID_PrintDone)
gotoPrintDone();
else
hmiReturnScreen();
else if (checkkey != ID_NothingToDo) { hmiReturnScreen(); }
}

void dwinLevelingStart() {
#if HAS_BED_PROBE
hmiSaveProcessID(ID_Leveling);
title.showCaption(GET_TEXT_F(MSG_BED_LEVELING));
dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT));
#if ALL(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING)
#if HAS_LEVELING
void dwinLevelingStart() {
#if HAS_BED_PROBE
hmiFlag.cancel_lev = 0;
hmiSaveProcessID(ID_Leveling);
title.showCaption(GET_TEXT_F(MSG_BED_LEVELING));
#if ENABLED(AUTO_BED_LEVELING_UBL)
meshViewer.drawMeshGrid(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
DWINUI::drawButton(BTN_Cancel, 86, 305, true);
#else
dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT));
#endif
#elif ENABLED(MESH_BED_LEVELING)
drawManualMeshMenu();
#endif

#if ENABLED(PREHEAT_BEFORE_LEVELING)
#if HAS_BED_PROBE
if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, hmiData.bedLevT);
#else
Expand All @@ -1516,14 +1531,22 @@ void dwinLevelingStart() {
#endif
#endif
#endif
#elif ENABLED(MESH_BED_LEVELING)
drawManualMeshMenu();
#endif
}
}

void dwinLevelingDone() {
TERN_(HAS_MESH, gotoMeshViewer(true));
}
void dwinLevelingDone() {
#if HAS_MESH
if (hmiFlag.cancel_lev) {
probe.stow();
reset_bed_level();
hmiReturnScreen();
ui.set_status(F("Mesh was cancelled"));
}
else {
gotoMeshViewer(true);
}
#endif
}
#endif // HAS_LEVELING

#if HAS_MESH
void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) {
Expand Down Expand Up @@ -2086,10 +2109,6 @@ void gotoInfoMenu() {

void disableMotors() { queue.inject(F("M84")); }

void autoLevel() { // Always reacquire the Z "home" position
queue.inject(F(TERN(AUTO_BED_LEVELING_UBL, "G29P1", "G29")));
}

void autoHome() { queue.inject_P(G28_STR); }

#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
Expand Down Expand Up @@ -2283,6 +2302,9 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS,
void setHSMode() { toggleCheckboxLine(bltouch.high_speed_mode); }
#endif

void autoLevel() {
queue.inject(F(TERN(AUTO_BED_LEVELING_UBL, "G29P1", "G29")));
}
#endif

#if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
Expand Down
16 changes: 10 additions & 6 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ typedef struct {
bool pause_flag:1; // printing is paused
bool select_flag:1; // Popup button selected
bool home_flag:1; // homing in course
bool cancel_lev:1; // cancel abl
} hmi_flag_t;

extern hmi_flag_t hmiFlag;
Expand All @@ -213,9 +214,13 @@ uint32_t getHash(char * str);
void saveMesh();
#endif
#endif
#if HAS_BED_PROBE
void autoLevel();
#else
void homeZAndDisable();
#endif
void rebootPrinter();
void disableMotors();
void autoLevel();
void autoHome();
#if HAS_PREHEAT
#define _DOPREHEAT(N) void DoPreheat##N();
Expand Down Expand Up @@ -247,9 +252,6 @@ void doCoolDown();
void ublMeshSave();
void ublMeshLoad();
#endif
#if DISABLED(HAS_BED_PROBE)
void homeZAndDisable();
#endif

// Other
void gotoPrintProcess();
Expand Down Expand Up @@ -278,8 +280,10 @@ void dwinHomingDone();
#if HAS_MESH
void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
#endif
void dwinLevelingStart();
void dwinLevelingDone();
#if HAS_LEVELING
void dwinLevelingStart();
void dwinLevelingDone();
#endif
void dwinPrintStarted();
void dwinPrintPause();
void dwinPrintResume();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void showCheckboxLine(const bool checked) {
}

void toggleCheckboxLine(bool &checked) {
checked = !checked;
checked ^= true;
showCheckboxLine(checked);
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
);
}
void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
UNUSED(with_probe);
IF_DISABLED(HAS_BED_PROBE, UNUSED(with_probe));
float zdest = zclear;
TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z);
NOMORE(zdest, Z_MAX_POS);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)

// Start preheating before waiting for user confirmation that the probe is ready.
TERN_(PREHEAT_BEFORE_PROBING, if (deploy) probe.preheat_for_probing(0, PROBING_BED_TEMP, true));
TERN_(PREHEAT_BEFORE_PROBING, if (deploy) probe.preheat_for_probing(PROBING_NOZZLE_TEMP, PROBING_BED_TEMP, true));

FSTR_P const ds_fstr = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW);
ui.return_to_status(); // To display the new status message
Expand Down
Loading