Kaynağa Gözat

Merge pull request #3222 from thinkyhead/rc_persist_endstop_enabling

M120/M121 also set endstops non-homing state
Scott Lahteine 9 yıl önce
ebeveyn
işleme
d62ba3d87e
3 değiştirilmiş dosya ile 26 ekleme ve 16 silme
  1. 9
    11
      Marlin/Marlin_main.cpp
  2. 14
    5
      Marlin/stepper.cpp
  3. 3
    0
      Marlin/stepper.h

+ 9
- 11
Marlin/Marlin_main.cpp Dosyayı Görüntüle

1475
   inline void raise_z_after_probing() { do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); }
1475
   inline void raise_z_after_probing() { do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); }
1476
 
1476
 
1477
   static void clean_up_after_endstop_move() {
1477
   static void clean_up_after_endstop_move() {
1478
-    #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
1479
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
1480
-        if (marlin_debug_flags & DEBUG_LEVELING) {
1481
-          SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > enable_endstops(false)");
1482
-        }
1483
-      #endif
1484
-      enable_endstops(false);
1478
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
1479
+      if (marlin_debug_flags & DEBUG_LEVELING) {
1480
+        SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > endstops_not_homing()");
1481
+      }
1485
     #endif
1482
     #endif
1483
+    endstops_not_homing();
1486
     feedrate = saved_feedrate;
1484
     feedrate = saved_feedrate;
1487
     feedrate_multiplier = saved_feedrate_multiplier;
1485
     feedrate_multiplier = saved_feedrate_multiplier;
1488
     refresh_cmd_timeout();
1486
     refresh_cmd_timeout();
4585
 }
4583
 }
4586
 
4584
 
4587
 /**
4585
 /**
4588
- * M120: Enable endstops
4586
+ * M120: Enable endstops and set non-homing endstop state to "enabled"
4589
  */
4587
  */
4590
-inline void gcode_M120() { enable_endstops(true); }
4588
+inline void gcode_M120() { enable_endstops_globally(true); }
4591
 
4589
 
4592
 /**
4590
 /**
4593
- * M121: Disable endstops
4591
+ * M121: Disable endstops and set non-homing endstop state to "disabled"
4594
  */
4592
  */
4595
-inline void gcode_M121() { enable_endstops(false); }
4593
+inline void gcode_M121() { enable_endstops_globally(false); }
4596
 
4594
 
4597
 #if ENABLED(BLINKM)
4595
 #if ENABLED(BLINKM)
4598
 
4596
 

+ 14
- 5
Marlin/stepper.cpp Dosyayı Görüntüle

99
 #endif
99
 #endif
100
 
100
 
101
 static bool check_endstops = true;
101
 static bool check_endstops = true;
102
+static bool check_endstops_global =
103
+  #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
104
+    false
105
+  #else
106
+    true
107
+  #endif
108
+;
102
 
109
 
103
 volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units
110
 volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units
104
 volatile signed char count_direction[NUM_AXIS] = { 1 };
111
 volatile signed char count_direction[NUM_AXIS] = { 1 };
252
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
259
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
253
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
260
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
254
 
261
 
255
-void endstops_hit_on_purpose() {
256
-  endstop_hit_bits = 0;
257
-}
262
+void enable_endstops(bool check) { check_endstops = check; }
263
+
264
+void enable_endstops_globally(bool check) { check_endstops_global = check_endstops = check; }
265
+
266
+void endstops_not_homing() { check_endstops = check_endstops_global; }
267
+
268
+void endstops_hit_on_purpose() { endstop_hit_bits = 0; }
258
 
269
 
259
 void checkHitEndstops() {
270
 void checkHitEndstops() {
260
   if (endstop_hit_bits) {
271
   if (endstop_hit_bits) {
293
   }
304
   }
294
 }
305
 }
295
 
306
 
296
-void enable_endstops(bool check) { check_endstops = check; }
297
-
298
 // Check endstops - Called from ISR!
307
 // Check endstops - Called from ISR!
299
 inline void update_endstops() {
308
 inline void update_endstops() {
300
 
309
 

+ 3
- 0
Marlin/stepper.h Dosyayı Görüntüle

54
 
54
 
55
 void enable_endstops(bool check); // Enable/disable endstop checking
55
 void enable_endstops(bool check); // Enable/disable endstop checking
56
 
56
 
57
+void enable_endstops_globally(bool check);
58
+void endstops_not_homing();
59
+
57
 void checkStepperErrors(); //Print errors detected by the stepper
60
 void checkStepperErrors(); //Print errors detected by the stepper
58
 
61
 
59
 void finishAndDisableSteppers();
62
 void finishAndDisableSteppers();

Loading…
İptal
Kaydet