Skip to content

Commit

Permalink
Add 'M413 C' to test PLR
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Sep 25, 2021
1 parent 6fb4a2c commit c6c7682
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
* - If backup power is available Retract E and Raise Z
* - Go to the KILL screen
*/
void PrintJobRecovery::_outage() {
void PrintJobRecovery::_outage(TERN_(DEBUG_POWER_LOSS_RECOVERY, const bool nokill/*=false*/)) {
#if ENABLED(BACKUP_POWER_SUPPLY)
static bool lock = false;
if (lock) return; // No re-entrance from idle() during retract_and_lift()
Expand Down Expand Up @@ -301,7 +301,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
retract_and_lift(zraise);
#endif

kill(GET_TEXT(MSG_OUTAGE_RECOVERY));
if (TERN0(DEBUG_POWER_LOSS_RECOVERY, nokill))
card.fileHasFinished();
else
kill(GET_TEXT(MSG_OUTAGE_RECOVERY));
}

#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ class PrintJobRecovery {
static void retract_and_lift(const_float_t zraise);
#endif

#if PIN_EXISTS(POWER_LOSS)
#if PIN_EXISTS(POWER_LOSS) || ENABLED(DEBUG_POWER_LOSS_RECOVERY)
friend class GcodeSuite;
static void _outage();
static void _outage(TERN_(DEBUG_POWER_LOSS_RECOVERY, const bool nokill=false));
#endif
};

Expand Down
5 changes: 2 additions & 3 deletions Marlin/src/gcode/feature/powerloss/M413.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ void GcodeSuite::M413() {
if (parser.seen_test('W')) recovery.save(true);
if (parser.seen_test('P')) recovery.purge();
if (parser.seen_test('D')) recovery.debug(PSTR("M413"));
#if PIN_EXISTS(POWER_LOSS)
if (parser.seen_test('O')) recovery._outage();
#endif
if (parser.seen_test('O')) recovery._outage();
if (parser.seen_test('C')) recovery.check();
if (parser.seen_test('E')) SERIAL_ECHOPGM_P(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n"));
if (parser.seen_test('V')) SERIAL_ECHOPGM_P(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n"));
#endif
Expand Down

0 comments on commit c6c7682

Please sign in to comment.