Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Invert FREEZE_FEATURE polarity #23942

Closed
KillerBug opened this issue Mar 24, 2022 · 3 comments
Closed

[FR] Invert FREEZE_FEATURE polarity #23942

KillerBug opened this issue Mar 24, 2022 · 3 comments
Labels
T: Feature Request Features requested by users.

Comments

@KillerBug
Copy link

Is your feature request related to a problem? Please describe.

No response

Are you looking for hardware support?

No response

Describe the feature you want

Currently the FREEZE_FEATURE only works with normally-open switches. Most emergency stop switches are normally-closed. It would be nice if there was something that could make it activate when high instead of when low.

Additional context

No response

@KillerBug KillerBug added the T: Feature Request Features requested by users. label Mar 24, 2022
@ellensp
Copy link
Contributor

ellensp commented Mar 25, 2022

This should work

diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 0a18e95ebc..1577f144fa 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -4113,6 +4113,7 @@
 //#define FREEZE_FEATURE
 #if ENABLED(FREEZE_FEATURE)
   //#define FREEZE_PIN 41   // Override the default (KILL) pin here
+  //#define INVERT_FREEZE_PIN 
 #endif
 
 /**
diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp
index 4117d3f382..2dcc6bfdae 100644
--- a/Marlin/src/MarlinCore.cpp
+++ b/Marlin/src/MarlinCore.cpp
@@ -476,7 +476,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
   #endif
 
   #if HAS_FREEZE_PIN
-    Stepper::frozen = !READ(FREEZE_PIN);
+    Stepper::frozen = READ(FREEZE_PIN) ^ DISABLED(INVERT_FREEZE_PIN);
   #endif
 
   #if HAS_HOME

@KillerBug
Copy link
Author

YES! That works. Gets me going but could it be built-in so modding MarlinCore.cpp isn't required?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests

2 participants