Make KEEPALIVE_STATE a scoped auto-restore (#14446)

This commit is contained in:
Scott Lahteine
2019-06-29 22:49:50 -05:00
committed by GitHub
parent 19aafb9050
commit d16954dc88
13 changed files with 18 additions and 98 deletions

View File

@ -978,8 +978,6 @@ G29_TYPE GcodeSuite::G29() {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
KEEPALIVE_STATE(IN_HANDLER);
if (planner.leveling_active)
sync_plan_position();

View File

@ -320,11 +320,11 @@ void GcodeSuite::M43() {
}
#if HAS_RESUME_CONTINUE
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = true;
#if ENABLED(HOST_PROMPT_SUPPORT)
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue"));
#endif
KEEPALIVE_STATE(PAUSED_FOR_USER);
#endif
for (;;) {
@ -346,7 +346,7 @@ void GcodeSuite::M43() {
}
#if HAS_RESUME_CONTINUE
if (!wait_for_user) { KEEPALIVE_STATE(IN_HANDLER); break; }
if (!wait_for_user) break;
#endif
safe_delay(200);

View File

@ -430,7 +430,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
//case 191: M191(); break; // M191: Wait for chamber temperature to reach target
#endif
case 105: M105(); KEEPALIVE_STATE(NOT_BUSY); return; // M105: Report Temperatures (and say "ok")
case 105: M105(); return; // M105: Report Temperatures (and say "ok")
#if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR
case 155: M155(); break; // M155: Set temperature auto-report interval
@ -796,8 +796,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
default: parser.unknown_command_error();
}
KEEPALIVE_STATE(NOT_BUSY);
if (!no_ok) queue.ok_to_send();
}

View File

@ -339,9 +339,9 @@ public:
static void host_keepalive();
#define KEEPALIVE_STATE(n) gcode.busy_state = gcode.n
#define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N)
#else
#define KEEPALIVE_STATE(n) NOOP
#define KEEPALIVE_STATE(N) NOOP
#endif
static void dwell(millis_t time);

View File

@ -118,7 +118,6 @@ void GcodeSuite::M0_M1() {
#endif
wait_for_user = false;
KEEPALIVE_STATE(IN_HANDLER);
}
#endif // HAS_RESUME_CONTINUE

View File

@ -62,10 +62,6 @@ void GcodeSuite::M303() {
#endif
thermalManager.PID_autotune(temp, e, c, u);
#if DISABLED(BUSY_WHILE_HEATING)
KEEPALIVE_STATE(IN_HANDLER);
#endif
}
#endif // HAS_PID_HEATING