Move some MarlinCore and MarlinUI code (#20832)
This commit is contained in:
@@ -61,7 +61,7 @@ GcodeSuite gcode;
|
||||
#include "../feature/password/password.h"
|
||||
#endif
|
||||
|
||||
#include "../MarlinCore.h" // for idle()
|
||||
#include "../MarlinCore.h" // for idle, kill
|
||||
|
||||
// Inactivity shutdown
|
||||
millis_t GcodeSuite::previous_move_ms = 0,
|
||||
@@ -209,6 +209,31 @@ void GcodeSuite::dwell(millis_t time) {
|
||||
*/
|
||||
#if BOTH(HAS_LEVELING, G29_RETRY_AND_RECOVER)
|
||||
|
||||
void GcodeSuite::event_probe_recover() {
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR));
|
||||
#ifdef ACTION_ON_G29_RECOVER
|
||||
host_action(PSTR(ACTION_ON_G29_RECOVER));
|
||||
#endif
|
||||
#ifdef G29_RECOVER_COMMANDS
|
||||
process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS));
|
||||
#endif
|
||||
}
|
||||
|
||||
void GcodeSuite::event_probe_failure() {
|
||||
#ifdef ACTION_ON_G29_FAILURE
|
||||
host_action(PSTR(ACTION_ON_G29_FAILURE));
|
||||
#endif
|
||||
#ifdef G29_FAILURE_COMMANDS
|
||||
process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS));
|
||||
#endif
|
||||
#if ENABLED(G29_HALT_ON_FAILURE)
|
||||
#ifdef ACTION_ON_CANCEL
|
||||
host_action_cancel();
|
||||
#endif
|
||||
kill(GET_TEXT(MSG_LCD_PROBING_FAILED));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef G29_MAX_RETRIES
|
||||
#define G29_MAX_RETRIES 0
|
||||
#endif
|
||||
@@ -216,7 +241,10 @@ void GcodeSuite::dwell(millis_t time) {
|
||||
void GcodeSuite::G29_with_retry() {
|
||||
uint8_t retries = G29_MAX_RETRIES;
|
||||
while (G29()) { // G29 should return true for failed probes ONLY
|
||||
if (retries--) event_probe_recover();
|
||||
if (retries) {
|
||||
event_probe_recover();
|
||||
--retries;
|
||||
}
|
||||
else {
|
||||
event_probe_failure();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user