Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻 ExtUI::onLevelingStart/Done for all leveling #25913

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH

#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
}
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
//SERIAL_ECHOLNPGM("onMeshUpdate() x:", xpos, " y:", ypos, " z:", zval);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
}
Expand Down
11 changes: 5 additions & 6 deletions Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ void DGUSScreenHandler::Loop() {
}

if (current_screen == DGUS_Screen::WAIT
&& ((wait_continue && !wait_for_user)
|| (!wait_continue && IsPrinterIdle()))
&& ((wait_continue && !wait_for_user) || (!wait_continue && IsPrinterIdle()))
) {
MoveToScreen(wait_return_screen, true);
return;
Expand All @@ -128,7 +127,7 @@ void DGUSScreenHandler::Loop() {
if (current_screen == DGUS_Screen::LEVELING_PROBING && IsPrinterIdle()) {
dgus_display.PlaySound(3);

SetStatusMessage(ExtUI::getMeshValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED));
SetStatusMessage(ExtUI::getLevelingIsValid() ? GET_TEXT_F(DGUS_MSG_PROBING_SUCCESS) : GET_TEXT_F(DGUS_MSG_PROBING_FAILED));

MoveToScreen(DGUS_Screen::LEVELING_AUTOMATIC);
return;
Expand Down Expand Up @@ -190,7 +189,7 @@ void DGUSScreenHandler::StoreSettings(char *buff) {
data.initialized = true;
data.volume = dgus_display.GetVolume();
data.brightness = dgus_display.GetBrightness();
data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getMeshValid());
data.abl_okay = (ExtUI::getLevelingActive() && ExtUI::getLevelingIsValid());

memcpy(buff, &data, sizeof(data));
}
Expand All @@ -206,7 +205,7 @@ void DGUSScreenHandler::LoadSettings(const char *buff) {
dgus_display.SetBrightness(data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS);

if (data.initialized) {
leveling_active = (data.abl_okay && ExtUI::getMeshValid());
leveling_active = (data.abl_okay && ExtUI::getLevelingIsValid());
ExtUI::setLevelingActive(leveling_active);
}
}
Expand Down Expand Up @@ -247,7 +246,7 @@ void DGUSScreenHandler::MeshUpdate(const int8_t xpos, const int8_t ypos) {
uint8_t point = ypos * GRID_MAX_POINTS_X + xpos;
probing_icons[point < 16 ? 0 : 1] |= (1U << (point % 16));

if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getMeshValid())
if (xpos >= GRID_MAX_POINTS_X - 1 && ypos >= GRID_MAX_POINTS_Y - 1 && !ExtUI::getLevelingIsValid())
probing_icons[0] = probing_icons[1] = 0;

TriggerFullUpdate();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool DGUSSetupHandler::LevelingOffset() {
}

bool DGUSSetupHandler::LevelingAutomatic() {
if (ExtUI::getMeshValid()) {
if (ExtUI::getLevelingIsValid()) {
dgus_screen_handler.leveling_active = true;

ExtUI::setLevelingActive(true);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ namespace ExtUI {
dgus_screen_handler.ConfigurationStoreRead(success);
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
dgus_screen_handler.MeshUpdate(xpos, ypos);
}
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {
// Called when any mesh points are updated
}
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ namespace ExtUI {
ConfirmUserRequestAlertBox::hide();
}

#if HAS_LEVELING && HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { BedMeshViewScreen::onMeshUpdate(x, y, val); }
void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { BedMeshViewScreen::onMeshUpdate(x, y, state); }
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void BedMeshEditScreen::setHighlightedValue(float value) {
}

void BedMeshEditScreen::moveToHighlightedValue() {
if (ExtUI::getMeshValid()) {
if (ExtUI::getLevelingIsValid()) {
ExtUI::setLevelingActive(true);
ExtUI::setSoftEndstopState(false);
ExtUI::moveToMeshPoint(mydata.highlight, gaugeThickness + mydata.zAdjustment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void BedMeshViewScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI
mydata.count = 0;
break;
case ExtUI::G29_FINISH:
if (mydata.count == GRID_MAX_POINTS && ExtUI::getMeshValid())
if (mydata.count == GRID_MAX_POINTS && ExtUI::getLevelingIsValid())
mydata.message = GET_TEXT_F(MSG_BED_MAPPING_DONE);
else
mydata.message = GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void onSettingsStored(const bool success) {

void onSettingsLoaded(const bool success) {
#if HAS_MESH
if (ExtUI::getMeshValid()) {
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
Expand Down Expand Up @@ -371,7 +371,7 @@ void onLevelingStart() {}

void onLevelingDone() {
#if HAS_MESH
if (ExtUI::getMeshValid()) {
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ void RTS::handleData() {
#if HAS_MESH
sendData(getLevelingActive() ? 3 : 2, AutoLevelIcon);

if (ExtUI::getMeshValid()) {
if (ExtUI::getLevelingIsValid()) {
uint8_t abl_probe_index = 0;
for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++)
for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) {
Expand Down
9 changes: 6 additions & 3 deletions Marlin/src/lcd/extui/malyan/malyan_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ namespace ExtUI {
void onSettingsStored(const bool) {}
void onSettingsLoaded(const bool) {}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) {}
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t, const int8_t, const_float_t) {}
void onMeshUpdate(const int8_t, const int8_t, const ExtUI::probe_state_t) {}
#endif

#if ENABLED(POWER_LOSS_RECOVERY)
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/nextion/nextion_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ namespace ExtUI {
// whether successful or not.
}

#if HAS_MESH
#if HAS_LEVELING
void onLevelingStart() {}
void onLevelingDone() {}
#endif

#if HAS_MESH
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
// Called when any mesh points are updated
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ namespace ExtUI {

bool getLevelingActive() { return planner.leveling_active; }
void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); }
bool getMeshValid() { return leveling_is_valid(); }
bool getLevelingIsValid() { return leveling_is_valid(); }

#if HAS_MESH

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ namespace ExtUI {
#if HAS_LEVELING
bool getLevelingActive();
void setLevelingActive(const bool);
bool getMeshValid();
bool getLevelingIsValid();
void onLevelingStart();
void onLevelingDone();
#if HAS_MESH
bed_mesh_t& getMeshArray();
float getMeshPoint(const xy_uint8_t &pos);
void setMeshPoint(const xy_uint8_t &pos, const_float_t zval);
void moveToMeshPoint(const xy_uint8_t &pos, const_float_t z);
void onLevelingStart();
void onLevelingDone();
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
inline void onMeshUpdate(const xy_int8_t &pos, const_float_t zval) { onMeshUpdate(pos.x, pos.y, zval); }

Expand Down