Add warning to ExtUI Bed Mesh Screen. (#19397)
- Show a warning on the Mesh Bed Leveling screen if some points aren't probed.
This commit is contained in:
parent
24d8daa01b
commit
c539254101
|
@ -145,6 +145,7 @@ namespace Language_en {
|
||||||
PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate";
|
PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate";
|
||||||
PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Level X Axis";
|
PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Level X Axis";
|
||||||
PROGMEM Language_Str MSG_BED_MAPPING_DONE = u8"Bed mapping finished";
|
PROGMEM Language_Str MSG_BED_MAPPING_DONE = u8"Bed mapping finished";
|
||||||
|
PROGMEM Language_Str MSG_BED_MAPPING_INCOMPLETE = u8"Not all points probed";
|
||||||
PROGMEM Language_Str MSG_LEVELING = u8"Leveling";
|
PROGMEM Language_Str MSG_LEVELING = u8"Leveling";
|
||||||
PROGMEM Language_Str MSG_SHOW_MESH = u8"Show Bed Mesh";
|
PROGMEM Language_Str MSG_SHOW_MESH = u8"Show Bed Mesh";
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) {
|
||||||
void BedMeshScreen::onEntry() {
|
void BedMeshScreen::onEntry() {
|
||||||
screen_data.BedMeshScreen.highlightedTag = 0;
|
screen_data.BedMeshScreen.highlightedTag = 0;
|
||||||
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
|
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
|
||||||
screen_data.BedMeshScreen.showMappingDone = false;
|
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
|
||||||
BaseScreen::onEntry();
|
BaseScreen::onEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,10 @@ void BedMeshScreen::drawHighlightedPointValue() {
|
||||||
.tag(1).button( OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY))
|
.tag(1).button( OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY))
|
||||||
.tag(0);
|
.tag(0);
|
||||||
|
|
||||||
if (screen_data.BedMeshScreen.showMappingDone) {
|
switch(screen_data.BedMeshScreen.message) {
|
||||||
cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE));
|
case screen_data.BedMeshScreen.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break;
|
||||||
|
case screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,15 +309,30 @@ void BedMeshScreen::onMeshUpdate(const int8_t, const int8_t, const float) {
|
||||||
onRefresh();
|
onRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BedMeshScreen::isMeshComplete(ExtUI::bed_mesh_t data) {
|
||||||
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
|
||||||
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) {
|
||||||
|
if (isnan(data[x][y])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
|
void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case ExtUI::MESH_START:
|
case ExtUI::MESH_START:
|
||||||
screen_data.BedMeshScreen.count = 0;
|
screen_data.BedMeshScreen.count = 0;
|
||||||
screen_data.BedMeshScreen.showMappingDone = false;
|
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
|
||||||
break;
|
break;
|
||||||
case ExtUI::MESH_FINISH:
|
case ExtUI::MESH_FINISH:
|
||||||
|
if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) {
|
||||||
|
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE;
|
||||||
|
} else {
|
||||||
|
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE;
|
||||||
|
}
|
||||||
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
|
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
|
||||||
screen_data.BedMeshScreen.showMappingDone = true;
|
|
||||||
break;
|
break;
|
||||||
case ExtUI::PROBE_START:
|
case ExtUI::PROBE_START:
|
||||||
screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y);
|
screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y);
|
||||||
|
|
|
@ -52,42 +52,46 @@ union screen_data_t {
|
||||||
uint8_t num_page;
|
uint8_t num_page;
|
||||||
uint8_t cur_page;
|
uint8_t cur_page;
|
||||||
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
|
#if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810)
|
||||||
uint16_t scroll_pos;
|
uint16_t scroll_pos;
|
||||||
uint16_t scroll_max;
|
uint16_t scroll_max;
|
||||||
#endif
|
#endif
|
||||||
} FilesScreen;
|
} FilesScreen;
|
||||||
struct {
|
struct {
|
||||||
struct base_numeric_adjustment_t placeholder;
|
struct base_numeric_adjustment_t placeholder;
|
||||||
float e_rel[ExtUI::extruderCount];
|
float e_rel[ExtUI::extruderCount];
|
||||||
} MoveAxisScreen;
|
} MoveAxisScreen;
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
struct {
|
struct {
|
||||||
bool showMappingDone;
|
enum : uint8_t {
|
||||||
uint8_t count;
|
MSG_NONE,
|
||||||
uint8_t highlightedTag;
|
MSG_MESH_COMPLETE,
|
||||||
} BedMeshScreen;
|
MSG_MESH_INCOMPLETE
|
||||||
#endif
|
} message;
|
||||||
#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
|
uint8_t count;
|
||||||
struct {
|
uint8_t highlightedTag;
|
||||||
uint32_t next_watchdog_trigger;
|
} BedMeshScreen;
|
||||||
const char* message;
|
#endif
|
||||||
} StressTestScreen;
|
#if ENABLED(TOUCH_UI_DEVELOPER_MENU)
|
||||||
#endif
|
struct {
|
||||||
#if ENABLED(TOUCH_UI_COCOA_PRESS)
|
uint32_t next_watchdog_trigger;
|
||||||
struct {
|
const char* message;
|
||||||
uint32_t start_ms;
|
} StressTestScreen;
|
||||||
} PreheatTimerScreen;
|
#endif
|
||||||
#endif
|
#if ENABLED(TOUCH_UI_COCOA_PRESS)
|
||||||
#if ENABLED(BABYSTEPPING)
|
struct {
|
||||||
struct {
|
uint32_t start_ms;
|
||||||
struct base_numeric_adjustment_t placeholder;
|
} PreheatTimerScreen;
|
||||||
xyz_int_t rel;
|
#endif
|
||||||
#if EXTRUDERS > 1
|
#if ENABLED(BABYSTEPPING)
|
||||||
bool link_nozzles;
|
struct {
|
||||||
#endif
|
struct base_numeric_adjustment_t placeholder;
|
||||||
bool show_offsets;
|
xyz_int_t rel;
|
||||||
} NudgeNozzleScreen;
|
#if EXTRUDERS > 1
|
||||||
#endif
|
bool link_nozzles;
|
||||||
|
#endif
|
||||||
|
bool show_offsets;
|
||||||
|
} NudgeNozzleScreen;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern screen_data_t screen_data;
|
extern screen_data_t screen_data;
|
||||||
|
|
|
@ -533,6 +533,7 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEP
|
||||||
static float getHightlightedValue();
|
static float getHightlightedValue();
|
||||||
static void drawHighlightedPointValue();
|
static void drawHighlightedPointValue();
|
||||||
static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1);
|
static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1);
|
||||||
|
static bool isMeshComplete(ExtUI::bed_mesh_t data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void onMeshUpdate(const int8_t x, const int8_t y, const float val);
|
static void onMeshUpdate(const int8_t x, const int8_t y, const float val);
|
||||||
|
|
Loading…
Reference in a new issue