Allow pullup/downs on power loss pin (#14986)
This commit is contained in:
committed by
Scott Lahteine
parent
19e21a8f10
commit
67f8ba6fed
@ -886,6 +886,10 @@ void setup() {
|
||||
runout.setup();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.setup();
|
||||
#endif
|
||||
|
||||
setup_killpin();
|
||||
|
||||
#if HAS_TMC220x
|
||||
|
@ -26,12 +26,16 @@
|
||||
*/
|
||||
|
||||
#include "../sd/cardreader.h"
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#include "../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
#if !defined(POWER_LOSS_STATE) && PIN_EXISTS(POWER_LOSS)
|
||||
#define POWER_LOSS_STATE HIGH
|
||||
#endif
|
||||
|
||||
//#define DEBUG_POWER_LOSS_RECOVERY
|
||||
//#define SAVE_EACH_CMD_MODE
|
||||
//#define SAVE_INFO_INTERVAL_MS 0
|
||||
@ -110,6 +114,20 @@ class PrintJobRecovery {
|
||||
|
||||
static void init();
|
||||
|
||||
static inline void setup() {
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
#if ENABLED(POWER_LOSS_PULL)
|
||||
#if POWER_LOSS_STATE == LOW
|
||||
SET_INPUT_PULLUP(POWER_LOSS_PIN);
|
||||
#else
|
||||
SET_INPUT_PULLDOWN(POWER_LOSS_PIN);
|
||||
#endif
|
||||
#else
|
||||
SET_INPUT(POWER_LOSS_PIN);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool enabled;
|
||||
static void enable(const bool onoff);
|
||||
static void changed();
|
||||
|
Reference in New Issue
Block a user