move G29 stuff to #27146

This commit is contained in:
Scott Lahteine
2024-06-02 14:43:22 -05:00
parent 81e4698097
commit 4d4fb0cf39
2 changed files with 17 additions and 29 deletions
+4 -11
View File
@@ -70,21 +70,14 @@
#endif #endif
#endif #endif
/**
* @brief Do some things before returning from G29.
* @param retry : true if the G29 can and should be retried. false if the failure is too serious.
* @param did : true if the leveling procedure completed successfully.
*/
static void pre_g29_return(const bool retry, const bool did) { static void pre_g29_return(const bool retry, const bool did) {
if (!retry) { if (!retry) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false)); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false));
} }
#if DISABLED(G29_RETRY_AND_RECOVER) if (did) {
if (!retry || did) { TERN_(DWIN_CREALITY_LCD, dwinLevelingDone());
TERN_(DWIN_CREALITY_LCD, dwinLevelingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); }
}
#endif
} }
#define G29_RETURN(retry, did) do{ \ #define G29_RETURN(retry, did) do{ \
+13 -18
View File
@@ -289,27 +289,22 @@ void GcodeSuite::dwell(millis_t time) {
void GcodeSuite::G29_with_retry() { void GcodeSuite::G29_with_retry() {
uint8_t retries = G29_MAX_RETRIES; uint8_t retries = G29_MAX_RETRIES;
bool fail = false; while (G29()) { // G29 should return true for failed probes ONLY
for (;;) { if (retries) {
fail = G29(); // G29 should return true for failed probes ONLY event_probe_recover();
if (!fail || !retries) break; --retries;
event_probe_recover(); }
--retries; else {
event_probe_failure();
return;
}
} }
if (fail) { TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end());
event_probe_failure();
TERN_(G29_HALT_ON_FAILURE, return);
}
else {
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end());
#ifdef G29_SUCCESS_COMMANDS
process_subcommands_now(F(G29_SUCCESS_COMMANDS));
#endif
}
TERN_(HAS_DWIN_E3V2_BASIC, dwinLevelingDone()); #ifdef G29_SUCCESS_COMMANDS
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); process_subcommands_now(F(G29_SUCCESS_COMMANDS));
#endif
} }
#endif // G29_RETRY_AND_RECOVER #endif // G29_RETRY_AND_RECOVER