Skip to content

Commit

Permalink
use has_mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 18, 2023
1 parent 884027a commit c94f04b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
3 changes: 0 additions & 3 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -290,6 +290,6 @@ bool BedLevelTools::meshValidate() {
drawing_mesh = false;
}

#endif // USE_GRID_MESHVIEWER
#endif // HAS_MESH

#endif // DWIN_LCD_PROUI && HAS_LEVELING
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -3489,7 +3489,7 @@ void drawMotionMenu() {
mMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, setMMeshMoveZ, &current_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);
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/meshviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
9 changes: 4 additions & 5 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -1680,7 +1679,7 @@ void MarlinSettings::postprocess() {
//
// Toggle the meshviewer
//
#if ENABLED(USE_GRID_MESHVIEWER)
#if HAS_MESH
EEPROM_WRITE(bedLevelTools.view_mesh);
#endif

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3214,7 +3213,7 @@ void MarlinSettings::reset() {
//
// Toggle the meshviewer
//
#if ENABLED(USE_GRID_MESHVIEWER)
#if HAS_MESH
bedLevelTools.view_mesh = false;
#endif

Expand Down

0 comments on commit c94f04b

Please sign in to comment.