Skip to content

Commit

Permalink
Proper pullup/pulldown configurability (MarlinFirmware#20242)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
  • Loading branch information
2 people authored and zillarob committed Feb 25, 2021
1 parent 6c2352a commit 84f456b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,8 @@
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
//#define POWER_LOSS_PULL // Set pullup / pulldown as appropriate
//#define POWER_LOSS_PULLUP // Set pullup / pulldown as appropriate for your sensor
//#define POWER_LOSS_PULLDOWN
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.

Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ class PrintJobRecovery {

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
#if ENABLED(POWER_LOSS_PULLUP)
SET_INPUT_PULLUP(POWER_LOSS_PIN);
#elif ENABLED(POWER_LOSS_PULLDOWN)
SET_INPUT_PULLDOWN(POWER_LOSS_PIN);
#else
SET_INPUT(POWER_LOSS_PIN);
#endif
Expand Down

0 comments on commit 84f456b

Please sign in to comment.