From c94f04b5ec916e31943a7943a7aa25ae6ffb7cd6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 18 Aug 2023 14:04:01 -0500 Subject: [PATCH] use has_mesh --- Marlin/src/inc/Conditionals_post.h | 3 --- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 6 +++--- Marlin/src/lcd/e3v2/proui/bedlevel_tools.h | 4 ++-- Marlin/src/lcd/e3v2/proui/dwin.cpp | 6 +++--- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 6 +++--- Marlin/src/module/settings.cpp | 9 ++++----- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 7aca3aac218b..33b42e851195 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2498,9 +2498,6 @@ #if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) #define PROUI_TUNING_GRAPH 1 #endif - #if HAS_MESH - #define GRID_MESH_VIEWER 1 - #endif #endif // Thermal protection diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index e8ebadfc5c15..f190e859efcb 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -65,7 +65,7 @@ BedLevelTools bedLevelTools; -#if ENABLED(USE_GRID_MESHVIEWER) +#if HAS_MESH bool BedLevelTools::view_mesh = false; bool BedLevelTools::viewer_print_value = false; #endif @@ -212,7 +212,7 @@ bool BedLevelTools::meshValidate() { return true; } -#if ENABLED(USE_GRID_MESHVIEWER) +#if HAS_MESH constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12); @@ -290,6 +290,6 @@ bool BedLevelTools::meshValidate() { drawing_mesh = false; } -#endif // USE_GRID_MESHVIEWER +#endif // HAS_MESH #endif // DWIN_LCD_PROUI && HAS_LEVELING diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h index d75845ffb9ad..d80d63be3e5d 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h @@ -52,7 +52,7 @@ class BedLevelTools { public: - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH static bool view_mesh; static bool viewer_print_value; #endif @@ -75,7 +75,7 @@ class BedLevelTools { static float getMaxValue(); static float getMinValue(); static bool meshValidate(); - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH static void drawBedMesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7)); static void setMeshViewerStatus(); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 16a849150dbf..42798af91767 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -2188,7 +2188,7 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, } #endif -#if HAS_MESH && USE_GRID_MESHVIEWER +#if HAS_MESH void setViewMesh() { toggleCheckboxLine(bedLevelTools.view_mesh); } @@ -3489,7 +3489,7 @@ void drawMotionMenu() { mMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, setMMeshMoveZ, ¤t_position.z); MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, manualMeshContinue); MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); - #if USE_GRID_MESHVIEWER + #if HAS_MESH EDIT_ITEM_F(ICON_PrintSize, "Change Mesh Viewer", onDrawChkbMenu, setViewMesh, &bedLevelTools.view_mesh); #endif MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, manualMeshSave); @@ -4014,7 +4014,7 @@ void drawStepsMenu() { MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, drawEditMeshMenu); #endif MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); - #if USE_GRID_MESHVIEWER + #if HAS_MESH EDIT_ITEM_F(ICON_PrintSize, "Change Mesh Viewer", onDrawChkbMenu, setViewMesh, &bedLevelTools.view_mesh); #endif } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 49ba754dafb0..33104efd4dd6 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -38,7 +38,7 @@ #include "../../../feature/bedlevel/bedlevel.h" #include "meshviewer.h" -#if ENABLED(USE_GRID_MESHVIEWER) +#if HAS_MESH #include "bedlevel_tools.h" #endif @@ -119,7 +119,7 @@ void MeshViewer::drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uin void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) { title.showCaption(GET_TEXT_F(MSG_MESH_VIEWER)); - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH if(bedLevelTools.view_mesh) { DWINUI::clearMainArea(); bedLevelTools.viewer_print_value = true; @@ -141,7 +141,7 @@ void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) else DWINUI::drawButton(BTN_Continue, 86, 305); - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH if(bedLevelTools.view_mesh) { bedLevelTools.setMeshViewerStatus(); } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index cfe890802d61..18d0a6ea6a63 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -583,11 +583,10 @@ typedef struct SettingsDataStruct { // // Toggle the meshviwer // - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH bool view_mesh; #endif - // // Fan tachometer check // @@ -1680,7 +1679,7 @@ void MarlinSettings::postprocess() { // // Toggle the meshviewer // - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH EEPROM_WRITE(bedLevelTools.view_mesh); #endif @@ -2747,7 +2746,7 @@ void MarlinSettings::postprocess() { // // Toggle the meshviewer // - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH _FIELD_TEST(view_mesh); EEPROM_READ(bedLevelTools.view_mesh); #endif @@ -3214,7 +3213,7 @@ void MarlinSettings::reset() { // // Toggle the meshviewer // - #if ENABLED(USE_GRID_MESHVIEWER) + #if HAS_MESH bedLevelTools.view_mesh = false; #endif