Browse Source

Debounce for Power-Loss pin

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
parent
commit
0c66c713b6
  1. 10
      Marlin/src/feature/powerloss.h

10
Marlin/src/feature/powerloss.h

@ -181,8 +181,14 @@ class PrintJobRecovery {
#if PIN_EXISTS(POWER_LOSS)
static inline void outage() {
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE)
_outage();
static constexpr uint8_t OUTAGE_THRESHOLD = 3;
static uint8_t outage_counter = 0;
if (enabled && READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) {
outage_counter++;
if (outage_counter >= OUTAGE_THRESHOLD) _outage();
}
else
outage_counter = 0;
}
#endif

Loading…
Cancel
Save