Move some MarlinCore and MarlinUI code (#20832)

This commit is contained in:
Scott Lahteine
2021-01-21 03:40:07 -06:00
committed by GitHub
parent ac82dc418a
commit c0870d417a
38 changed files with 178 additions and 206 deletions

View File

@@ -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;