Browse Source

M120/M121 also set endstops non-homing state

Scott Lahteine 8 years ago
parent
commit
af32a7d5d6
3 changed files with 26 additions and 16 deletions
  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 View File

@@ -1475,14 +1475,12 @@ static void setup_for_endstop_move() {
1475 1475
   inline void raise_z_after_probing() { do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); }
1476 1476
 
1477 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 1482
     #endif
1483
+    endstops_not_homing();
1486 1484
     feedrate = saved_feedrate;
1487 1485
     feedrate_multiplier = saved_feedrate_multiplier;
1488 1486
     refresh_cmd_timeout();
@@ -4585,14 +4583,14 @@ inline void gcode_M119() {
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 4595
 #if ENABLED(BLINKM)
4598 4596
 

+ 14
- 5
Marlin/stepper.cpp View File

@@ -99,6 +99,13 @@ static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_
99 99
 #endif
100 100
 
101 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 110
 volatile long count_position[NUM_AXIS] = { 0 }; // Positions of stepper motors, in step units
104 111
 volatile signed char count_direction[NUM_AXIS] = { 1 };
@@ -252,9 +259,13 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
252 259
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
253 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 270
 void checkHitEndstops() {
260 271
   if (endstop_hit_bits) {
@@ -293,8 +304,6 @@ void checkHitEndstops() {
293 304
   }
294 305
 }
295 306
 
296
-void enable_endstops(bool check) { check_endstops = check; }
297
-
298 307
 // Check endstops - Called from ISR!
299 308
 inline void update_endstops() {
300 309
 

+ 3
- 0
Marlin/stepper.h View File

@@ -54,6 +54,9 @@ void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homi
54 54
 
55 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 60
 void checkStepperErrors(); //Print errors detected by the stepper
58 61
 
59 62
 void finishAndDisableSteppers();

Loading…
Cancel
Save