Skip to content

Commit 55811b6

Browse files
committed
conditional
1 parent 31e3611 commit 55811b6

15 files changed

Lines changed: 35 additions & 37 deletions

File tree

Marlin/src/feature/bedlevel/abl/bbl.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,9 @@ void LevelingBilinear::reset() {
110110
* Set grid spacing and start position
111111
*/
112112
void LevelingBilinear::set_grid(const xy_pos_t& _grid_spacing, const xy_pos_t& _grid_start) {
113-
#if ENABLED(PROUI_MESH_EDIT)
114-
UNUSED(_grid_spacing); UNUSED(_grid_start);
115-
grid_start = mesh_min;
113+
#if HAS_PROUI_MESH_EDIT
116114
grid_spacing.set(MESH_X_DIST, MESH_Y_DIST);
115+
grid_start = mesh_min;
117116
#else
118117
grid_spacing = _grid_spacing;
119118
grid_start = _grid_start;

Marlin/src/feature/bedlevel/bedlevel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
#include "../../lcd/extui/ui_api.h"
4747
#endif
4848

49-
#if ALL(HAS_MESH, DWIN_LCD_PROUI)
49+
#if HAS_PROUI_MESH_EDIT
5050
#include "../../lcd/dwin/proui/bedlevel_tools.h"
5151
#endif
5252

5353
bool leveling_is_valid() {
5454
return (
55-
#if ALL(HAS_MESH, DWIN_LCD_PROUI)
55+
#if HAS_PROUI_MESH_EDIT
5656
bedLevelTools.meshValidate()
5757
#else
5858
TERN1(HAS_MESH, bedlevel.mesh_is_valid())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int8_t unified_bed_leveling::storage_slot;
6565

6666
bed_mesh_t unified_bed_leveling::z_values;
6767

68-
#if DISABLED(PROUI_MESH_EDIT)
68+
#if !HAS_PROUI_MESH_EDIT
6969
#define _GRIDPOS(A,N) (MESH_MIN_##A + N * (MESH_##A##_DIST))
7070

7171
const float

Marlin/src/feature/bedlevel/ubl/ubl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class unified_bed_leveling {
114114
static void set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values);
115115
#endif
116116

117-
#if DISABLED(PROUI_MESH_EDIT)
117+
#if !HAS_PROUI_MESH_EDIT
118118
static const float _mesh_index_to_xpos[GRID_MAX_POINTS_X],
119119
_mesh_index_to_ypos[GRID_MAX_POINTS_Y];
120120
#endif
@@ -290,7 +290,7 @@ class unified_bed_leveling {
290290
static float _get_mesh_x(const uint8_t i) { return mesh_min.x + i * (MESH_X_DIST); }
291291
static float _get_mesh_y(const uint8_t i) { return mesh_min.y + i * (MESH_Y_DIST); }
292292

293-
#if ENABLED(PROUI_MESH_EDIT)
293+
#if HAS_PROUI_MESH_EDIT
294294
static float get_mesh_x(const uint8_t i) { return _get_mesh_x(i); }
295295
static float get_mesh_y(const uint8_t i) { return _get_mesh_y(i); }
296296
#else

Marlin/src/inc/Conditionals-2-LCD.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@
581581
#define DO_LIST_BIN_FILES 1
582582
#define LCD_BRIGHTNESS_DEFAULT 127
583583
#define STATUS_DO_CLEAR_EMPTY
584+
#if HAS_MESH
585+
#define HAS_PROUI_MESH_EDIT 1
586+
#endif
584587
#endif
585588

586589
// Serial Controllers require LCD_SERIAL_PORT

Marlin/src/inc/MarlinConfigPre.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,3 @@
5151
#ifndef __MARLIN_DEPS__
5252
#include HAL_PATH(.., inc/Conditionals_adv.h)
5353
#endif
54-
55-
#if ENABLED(DWIN_LCD_PROUI)
56-
#include "../lcd/dwin/proui/dwin_defines.h" // for ProUI extra features
57-
#endif

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545

4646
#if ALL(DWIN_LCD_PROUI, HAS_LEVELING)
4747

48+
#include "dwin.h"
49+
#include "dwinui.h"
50+
#include "dwin_popup.h"
51+
#include "bedlevel_tools.h"
52+
4853
#include "../../marlinui.h"
4954
#include "../../../core/types.h"
5055
#include "../../../feature/bedlevel/bedlevel.h"
@@ -55,11 +60,6 @@
5560
#include "../../../libs/least_squares_fit.h"
5661
#include "../../../libs/vector_3.h"
5762

58-
#include "dwin.h"
59-
#include "dwinui.h"
60-
#include "dwin_popup.h"
61-
#include "bedlevel_tools.h"
62-
6363
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
6464
#include "../../../core/debug_out.h"
6565

@@ -188,7 +188,8 @@ bool BedLevelTools::meshValidate() {
188188
return false;
189189
GRID_LOOP(x, y) {
190190
const float z = bedlevel.z_values[x][y];
191-
if (isnan(z) || !WITHIN(z, Z_OFFSET_MIN, Z_OFFSET_MAX)) return false;
191+
if (isnan(z) || TERN0(HAS_PROUI_MESH_EDIT, !WITHIN(z, Z_OFFSET_MIN, Z_OFFSET_MAX)))
192+
return false;
192193
}
193194
return true;
194195
}

Marlin/src/lcd/dwin/proui/dwin.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Menu *stepsMenu = nullptr;
276276
#endif
277277
#if HAS_MESH
278278
Menu *meshMenu = nullptr;
279-
#if ENABLED(PROUI_MESH_EDIT)
279+
#if HAS_PROUI_MESH_EDIT
280280
Menu *meshInsetMenu = nullptr;
281281
Menu *editMeshMenu = nullptr;
282282
#endif
@@ -4415,15 +4415,15 @@ void drawMaxAccelMenu() {
44154415

44164416
void drawMeshSetMenu() {
44174417
constexpr uint8_t items = (1
4418-
+ ENABLED(PROUI_MESH_EDIT)
4418+
+ ENABLED(HAS_PROUI_MESH_EDIT)
44194419
+ ENABLED(PREHEAT_BEFORE_LEVELING)
44204420
+ 2
44214421
+ ENABLED(AUTO_BED_LEVELING_UBL)
44224422
);
44234423
checkkey = ID_Menu;
44244424
if (SET_MENU(meshMenu, MSG_MESH_LEVELING, items)) {
44254425
BACK_ITEM(drawLevelMenu);
4426-
#if ENABLED(PROUI_MESH_EDIT)
4426+
#if HAS_PROUI_MESH_EDIT
44274427
MENU_ITEM(ICON_ProbeMargin, MSG_MESH_INSET, onDrawSubMenu, drawMeshInsetMenu);
44284428
#endif
44294429
#if ENABLED(PREHEAT_BEFORE_LEVELING)
@@ -4438,7 +4438,7 @@ void drawMaxAccelMenu() {
44384438
updateMenu(meshMenu);
44394439
}
44404440

4441-
#if ENABLED(PROUI_MESH_EDIT)
4441+
#if HAS_PROUI_MESH_EDIT
44424442
bool autoMovToMesh = false;
44434443
void setAutoMovToMesh() { toggleCheckboxLine(autoMovToMesh); }
44444444

@@ -4523,7 +4523,7 @@ void drawLevelMenu() {
45234523
+ ENABLED(MESH_BED_LEVELING)
45244524
+ TERN0(HAS_BED_PROBE, 2)
45254525
+ ENABLED(HAS_HOME_OFFSET)
4526-
+ TERN0(HAS_MESH, 2 + ENABLED(USE_GRID_MESHVIEWER) + TERN0(PROUI_MESH_EDIT, 2))
4526+
+ TERN0(HAS_MESH, 2 + ENABLED(USE_GRID_MESHVIEWER) + TERN0(HAS_PROUI_MESH_EDIT, 2))
45274527
+ TERN0(AUTO_BED_LEVELING_UBL, 5)
45284528
);
45294529
checkkey = ID_Menu;
@@ -4547,7 +4547,7 @@ void drawLevelMenu() {
45474547
MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW_GRID, onDrawSubMenu, dwinMeshViewerGrid);
45484548
#endif
45494549
MENU_ITEM(ICON_Mesh, MSG_MESH_SETTINGS, onDrawSubMenu, drawMeshSetMenu);
4550-
#if ENABLED(PROUI_MESH_EDIT)
4550+
#if HAS_PROUI_MESH_EDIT
45514551
MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, drawEditMeshMenu);
45524552
MENU_ITEM(ICON_MeshReset, MSG_MESH_RESET, onDrawMenuItem, resetMesh);
45534553
#endif

Marlin/src/lcd/dwin/proui/dwin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include "../../../inc/MarlinConfig.h"
3333

34+
#include "dwin_defines.h"
3435
#include "dwinui.h"
3536
#include "../common/encoder.h"
3637
#include "../common/limits.h"
@@ -399,7 +400,7 @@ void drawMaxAccelMenu();
399400
#endif
400401
#if HAS_MESH
401402
void drawMeshSetMenu();
402-
#if ENABLED(PROUI_MESH_EDIT)
403+
#if HAS_PROUI_MESH_EDIT
403404
void drawMeshInsetMenu();
404405
void drawEditMeshMenu();
405406
#endif

Marlin/src/lcd/dwin/proui/dwin_defines.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@
8888
/**
8989
* ProUI internal feature flags
9090
*/
91-
#if HAS_MESH
92-
#define PROUI_MESH_EDIT // Add a menu to edit mesh inset + points
93-
#define Z_OFFSET_MIN -3.0 // (mm)
94-
#define Z_OFFSET_MAX 3.0 // (mm)
95-
#endif
9691
#if HAS_BED_PROBE
9792
#define PROUI_ITEM_ZFR // Add a menu item to change Z_PROBE_FEEDRATE_SLOW - probe speed
9893
#endif
@@ -121,7 +116,9 @@
121116
#define HAS_SD_EXTENDER 1 // Enable to support SD card extender cables
122117
#define USE_GRID_MESHVIEWER 1 // Enable for two mesh graph types
123118

124-
#if ENABLED(PROUI_MESH_EDIT)
119+
#if HAS_PROUI_MESH_EDIT
120+
#define Z_OFFSET_MIN -3.0 // (mm)
121+
#define Z_OFFSET_MAX 3.0 // (mm)
125122
#ifndef MESH_INSET
126123
#define MESH_INSET 10
127124
#endif

0 commit comments

Comments
 (0)