Selaa lähdekoodia

✨ Configurable FREEZE pin state (#23944)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
ellensp 2 vuotta sitten
vanhempi
commit
20b5615305
No account linked to committer's email address

+ 1
- 0
Marlin/Configuration_adv.h Näytä tiedosto

@@ -4116,6 +4116,7 @@
4116 4116
 //#define FREEZE_FEATURE
4117 4117
 #if ENABLED(FREEZE_FEATURE)
4118 4118
   //#define FREEZE_PIN 41   // Override the default (KILL) pin here
4119
+  #define FREEZE_STATE LOW  // State of pin indicating freeze
4119 4120
 #endif
4120 4121
 
4121 4122
 /**

+ 7
- 3
Marlin/src/MarlinCore.cpp Näytä tiedosto

@@ -476,7 +476,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
476 476
   #endif
477 477
 
478 478
   #if HAS_FREEZE_PIN
479
-    Stepper::frozen = !READ(FREEZE_PIN);
479
+    Stepper::frozen = READ(FREEZE_PIN) ^ DISABLED(INVERT_FREEZE_PIN);
480 480
   #endif
481 481
 
482 482
   #if HAS_HOME
@@ -1166,9 +1166,13 @@ void setup() {
1166 1166
     #endif
1167 1167
   #endif
1168 1168
 
1169
-  #if HAS_FREEZE_PIN
1169
+  #if ENABLED(FREEZE_FEATURE)
1170 1170
     SETUP_LOG("FREEZE_PIN");
1171
-    SET_INPUT_PULLUP(FREEZE_PIN);
1171
+    #if FREEZE_STATE
1172
+      SET_INPUT_PULLDOWN(FREEZE_PIN);
1173
+    #else
1174
+      SET_INPUT_PULLUP(FREEZE_PIN);
1175
+    #endif
1172 1176
   #endif
1173 1177
 
1174 1178
   #if HAS_SUICIDE

+ 3
- 11
Marlin/src/inc/Conditionals_post.h Näytä tiedosto

@@ -2824,17 +2824,9 @@
2824 2824
 #endif
2825 2825
 
2826 2826
 // User Interface
2827
-#if ENABLED(FREEZE_FEATURE)
2828
-  #if !PIN_EXISTS(FREEZE) && PIN_EXISTS(KILL)
2829
-    #define FREEZE_PIN KILL_PIN
2830
-  #endif
2831
-  #if PIN_EXISTS(FREEZE)
2832
-    #define HAS_FREEZE_PIN 1
2833
-  #endif
2834
-#else
2835
-  #undef FREEZE_PIN
2836
-#endif
2837
-#if PIN_EXISTS(KILL) && TERN1(FREEZE_FEATURE, KILL_PIN != FREEZE_PIN)
2827
+#if ENABLED(FREEZE_FEATURE) && !PIN_EXISTS(FREEZE) && PIN_EXISTS(KILL)
2828
+  #define FREEZE_PIN KILL_PIN
2829
+#elif PIN_EXISTS(KILL) && TERN1(FREEZE_FEATURE, KILL_PIN != FREEZE_PIN)
2838 2830
   #define HAS_KILL 1
2839 2831
 #endif
2840 2832
 #if PIN_EXISTS(HOME)

+ 2
- 2
Marlin/src/inc/SanityCheck.h Näytä tiedosto

@@ -1035,8 +1035,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
1035 1035
 /**
1036 1036
  * Instant Freeze
1037 1037
  */
1038
-#if ENABLED(FREEZE_FEATURE) && !PIN_EXISTS(FREEZE)
1039
-  #error "FREEZE_FEATURE requires a FREEZE_PIN to be defined."
1038
+#if ENABLED(FREEZE_FEATURE) && !(PIN_EXISTS(FREEZE) && defined(FREEZE_STATE))
1039
+  #error "FREEZE_FEATURE requires both FREEZE_PIN and FREEZE_STATE."
1040 1040
 #endif
1041 1041
 
1042 1042
 /**

+ 2
- 2
Marlin/src/module/stepper.cpp Näytä tiedosto

@@ -189,7 +189,7 @@ bool Stepper::abort_current_block;
189 189
 uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
190 190
 uint8_t Stepper::steps_per_isr;
191 191
 
192
-#if HAS_FREEZE_PIN
192
+#if ENABLED(FREEZE_FEATURE)
193 193
   bool Stepper::frozen; // = false
194 194
 #endif
195 195
 
@@ -1643,7 +1643,7 @@ void Stepper::pulse_phase_isr() {
1643 1643
   if (!current_block) return;
1644 1644
 
1645 1645
   // Skipping step processing causes motion to freeze
1646
-  if (TERN0(HAS_FREEZE_PIN, frozen)) return;
1646
+  if (TERN0(FREEZE_FEATURE, frozen)) return;
1647 1647
 
1648 1648
   // Count of pending loops and events for this iteration
1649 1649
   const uint32_t pending_events = step_event_count - step_events_completed;

+ 1
- 1
Marlin/src/module/stepper.h Näytä tiedosto

@@ -336,7 +336,7 @@ class Stepper {
336 336
       static constexpr uint8_t last_moved_extruder = 0;
337 337
     #endif
338 338
 
339
-    #if HAS_FREEZE_PIN
339
+    #if ENABLED(FREEZE_FEATURE)
340 340
       static bool frozen;                   // Set this flag to instantly freeze motion
341 341
     #endif
342 342
 

+ 1
- 1
Marlin/src/pins/pinsDebug_list.h Näytä tiedosto

@@ -823,7 +823,7 @@
823 823
 #if HAS_KILL
824 824
   REPORT_NAME_DIGITAL(__LINE__, KILL_PIN)
825 825
 #endif
826
-#if HAS_FREEZE_PIN
826
+#if PIN_EXISTS(FREEZE)
827 827
   REPORT_NAME_DIGITAL(__LINE__, FREEZE_PIN)
828 828
 #endif
829 829
 #if PIN_EXISTS(LCD_BACKLIGHT)

Loading…
Peruuta
Tallenna