E3V2 (Enhanced) Mesh Viewer (#22844)

This commit is contained in:
Miguel Risco-Castillo
2021-09-27 14:47:47 -05:00
committed by GitHub
parent 8f9e56afb9
commit 8ab02df63a
10 changed files with 136 additions and 9 deletions

View File

@@ -62,7 +62,7 @@
#include "../../../feature/host_actions.h"
#endif
#if HAS_ONESTEP_LEVELING
#if HAS_MESH || HAS_ONESTEP_LEVELING
#include "../../../feature/bedlevel/bedlevel.h"
#endif
@@ -78,6 +78,10 @@
#include "../../../feature/powerloss.h"
#endif
#if HAS_MESH
#include "meshviewer.h"
#endif
#include <WString.h>
#include <stdio.h>
#include <string.h>
@@ -1661,7 +1665,7 @@ void DWIN_MeshLevelingStart() {
#endif
}
void DWIN_CompletedLeveling() { HMI_ReturnScreen(); }
void DWIN_CompletedLeveling() { DWIN_MeshViewer(); }
#if HAS_MESH
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
@@ -1921,6 +1925,17 @@ void DWIN_Redraw_screen() {
#endif // ADVANCED_PAUSE_FEATURE
#if HAS_MESH
void DWIN_MeshViewer() {
if (!leveling_is_valid())
DWIN_Popup_Continue(ICON_BLTouch, "Mesh viewer", "No valid mesh");
else {
HMI_SaveProcessID(WaitResponse);
MeshViewer.Draw();
}
}
#endif
void HMI_LockScreen() {
EncoderState encoder_diffState = get_encoder_state();
if (encoder_diffState == ENCODER_DIFF_NO) return;
@@ -3185,6 +3200,9 @@ void Draw_AdvancedSettings_Menu() {
#if ENABLED(SOUND_MENU_ITEM)
ADDMENUITEM(ICON_Sound, F("Enable Sound"), onDrawEnableSound, SetEnableSound);
#endif
#if HAS_MESH
ADDMENUITEM(ICON_MeshViewer, GET_TEXT_F(MSG_MESH_VIEW), onDrawSubMenu, DWIN_MeshViewer);
#endif
ADDMENUITEM(ICON_Lock, F("Lock Screen"), onDrawMenuItem, Goto_LockScreen);
}
CurrentMenu->draw();
@@ -3403,6 +3421,7 @@ void Draw_Motion_Menu() {
ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart);
MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, &current_position.z);
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue);
ADDMENUITEM(ICON_MeshViewer, GET_TEXT_F(MSG_MESH_VIEW), onDrawSubMenu, DWIN_MeshViewer);
ADDMENUITEM(ICON_MeshSave, GET_TEXT_F(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave);
}
CurrentMenu->draw();