Fix and improve POWER_LOSS_RECOVERY (#11187)

This commit is contained in:
Scott Lahteine
2018-07-02 23:21:28 -05:00
committed by GitHub
parent e0ab8acf19
commit 1a0f4dedad
9 changed files with 134 additions and 72 deletions

View File

@ -496,7 +496,7 @@ inline void get_serial_commands() {
if (job_recovery_commands_count) {
if (_enqueuecommand(job_recovery_commands[job_recovery_commands_index])) {
++job_recovery_commands_index;
if (!--job_recovery_commands_count) job_recovery_phase = JOB_RECOVERY_IDLE;
if (!--job_recovery_commands_count) job_recovery_phase = JOB_RECOVERY_DONE;
}
return true;
}

View File

@ -72,6 +72,9 @@ void GcodeSuite::M22() { card.release(); }
* M23: Open a file
*/
void GcodeSuite::M23() {
#if ENABLED(POWER_LOSS_RECOVERY)
card.removeJobRecoveryFile();
#endif
// Simplify3D includes the size, so zero out all spaces (#7227)
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
card.openFile(parser.string_arg, true);
@ -81,16 +84,22 @@ void GcodeSuite::M23() {
* M24: Start or Resume SD Print
*/
void GcodeSuite::M24() {
#if ENABLED(POWER_LOSS_RECOVERY)
card.removeJobRecoveryFile();
#endif
#if ENABLED(PARK_HEAD_ON_PAUSE)
resume_print();
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
if (parser.seenval('S')) card.setIndex(parser.value_long());
#endif
card.startFileprint();
print_job_timer.start();
#if ENABLED(POWER_LOSS_RECOVERY)
if (parser.seenval('T'))
print_job_timer.resume(parser.value_long());
else
#endif
print_job_timer.start();
}
/**