Skip to content

Commit

Permalink
misc. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 14, 2022
1 parent aa4edbf commit 2a347e4
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 23 deletions.
10 changes: 6 additions & 4 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

BedLevelToolsClass BedLevelTools;

#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER
bool BedLevelToolsClass::viewer_asymmetric_range = false;
bool BedLevelToolsClass::viewer_print_value = false;
#endif
Expand Down Expand Up @@ -202,7 +202,8 @@ bool BedLevelToolsClass::meshvalidate() {
return (max <= MESH_Z_OFFSET_MAX) && (min >= MESH_Z_OFFSET_MIN);
}

#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER

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*/) {
drawing_mesh = true;
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
Expand Down Expand Up @@ -279,6 +280,7 @@ bool BedLevelToolsClass::meshvalidate() {
ui.set_status(msg);
drawing_mesh = false;
}
#endif

#endif // DWIN_LCD_PROUI
#endif // USE_UBL_VIEWER

#endif // DWIN_LCD_PROUI && HAS_LEVELING
8 changes: 5 additions & 3 deletions Marlin/src/lcd/e3v2/proui/bedlevel_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@

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

//#define USE_UBL_VIEWER 1
#if ENABLED(AUTO_BED_LEVELING_UBL)
//#define USE_UBL_VIEWER 1
#endif

#define MESH_Z_OFFSET_MIN -3.0
#define MESH_Z_OFFSET_MAX 3.0

class BedLevelToolsClass {
public:
#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER
static bool viewer_asymmetric_range;
static bool viewer_print_value;
#endif
Expand All @@ -64,7 +66,7 @@ class BedLevelToolsClass {
static float get_max_value();
static float get_min_value();
static bool meshvalidate();
#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER
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);
static void Set_Mesh_Viewer_Status();
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@
#include "../../../module/probe.h"
#endif

#ifdef BLTOUCH
#if ENABLED(BLTOUCH)
#include "../../../feature/bltouch.h"
#endif

#if ANY(BABYSTEPPING, HAS_BED_PROBE)
#if EITHER(BABYSTEPPING, HAS_BED_PROBE)
#define HAS_ZOFFSET_ITEM 1
#if ENABLED(BABYSTEPPING)
#include "../../../feature/babystep.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/dwin_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
//#define NEED_HEX_PRINT 1

#include "../../../inc/MarlinConfigPre.h"
#include <stddef.h>
#include "../common/dwin_color.h"
#include <stddef.h>

#if defined(__STM32F1__) || defined(STM32F1)
#define DASH_REDRAW 1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/lockscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
DWIN_UpdateLCD();
}

#endif // HAS_LOCK_SCREEN
#endif // HAS_LOCKSCREEN

#endif // DWIN_LCD_PROUI
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) {

void DrawItemEdit() {
switch (checkkey) {
case SetIntNoDraw: if(MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
case SetInt:
case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break;
case SetFloat:
Expand Down Expand Up @@ -558,8 +558,8 @@ void UpdateMenu(MenuClass* &menu) {
menu->draw();
}

void ReDrawMenu(bool force /*= false*/) {
if (CurrentMenu && (force || checkkey==Menu)) CurrentMenu->draw();
void ReDrawMenu(cont bool force/*=false*/) {
if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw();
if (force) DrawItemEdit();
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems);
void UpdateMenu(MenuClass* &menu);

//Redraw the current Menu if it is valid
void ReDrawMenu(bool force = false);
void ReDrawMenu(const bool force=false);

// Clear MenuItems array and free MenuItems elements
void MenuItemsClear();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/meshviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8

void MeshViewerClass::Draw(bool withsave /*= false*/) {
Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER
DWINUI::ClearMainArea();
BedLevelTools.viewer_print_value = true;
BedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
Expand All @@ -126,7 +126,7 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) {
else
DWINUI::Draw_Button(BTN_Continue, 86, 305);

#if ENABLED(USE_UBL_VIEWER)
#if USE_UBL_VIEWER
BedLevelTools.Set_Mesh_Viewer_Status();
#else
char str_1[6], str_2[6] = "";
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

#include "dwin_defines.h"

#ifdef HAS_PIDPLOT
#if HAS_PIDPLOT

#include "plot.h"

Expand Down Expand Up @@ -96,4 +96,4 @@ void PlotClass::Update(const float value) {

#endif // HAS_PIDPLOT

#endif // DWIN_LCD_PROUI
#endif // DWIN_LCD_PROUI
7 changes: 3 additions & 4 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,15 +2771,14 @@ void MarlinSettings::postprocess() {
#endif

#if ENABLED(DWIN_LCD_PROUI)
if (BedLevelTools.meshvalidate()) {
const bool ok = BedLevelTools.meshvalidate();
DONE_BUZZ(ok);
if (ok)
ui.status_printf(0, GET_TEXT_F(MSG_MESH_LOADED), bedlevel.storage_slot);
DONE_BUZZ(true);
}
else {
status = true;
bedlevel.invalidate();
LCD_MESSAGE(MSG_UBL_MESH_INVALID);
DONE_BUZZ(false);
}
#endif

Expand Down

0 comments on commit 2a347e4

Please sign in to comment.