Browse Source

Ensble/disable hardware endstops in G28 globally.

For moving away from the endstops we do not have to disable them.
They are not tested anyway.
AnHardt 9 years ago
parent
commit
eff7912243
1 changed files with 9 additions and 29 deletions
  1. 9
    29
      Marlin/Marlin_main.cpp

+ 9
- 29
Marlin/Marlin_main.cpp View File

@@ -2390,21 +2390,11 @@ static void homeaxis(AxisEnum axis) {
2390 2390
     current_position[axis] = 0;
2391 2391
     sync_plan_position();
2392 2392
 
2393
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
2394
-      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2395
-    #endif
2396
-    endstops.enable(false); // Disable endstops while moving away
2397
-
2398 2393
     // Move away from the endstop by the axis HOME_BUMP_MM
2399 2394
     destination[axis] = -home_bump_mm(axis) * axis_home_dir;
2400 2395
     line_to_destination();
2401 2396
     stepper.synchronize();
2402 2397
 
2403
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
2404
-      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
2405
-    #endif
2406
-    endstops.enable(true); // Enable endstops for next homing move
2407
-
2408 2398
     // Slow down the feedrate for the next move
2409 2399
     set_homing_bump_feedrate(axis);
2410 2400
 
@@ -2445,10 +2435,6 @@ static void homeaxis(AxisEnum axis) {
2445 2435
     #if ENABLED(DELTA)
2446 2436
       // retrace by the amount specified in endstop_adj
2447 2437
       if (endstop_adj[axis] * axis_home_dir < 0) {
2448
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2449
-          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2450
-        #endif
2451
-        endstops.enable(false); // Disable endstops while moving away
2452 2438
         sync_plan_position();
2453 2439
         destination[axis] = endstop_adj[axis];
2454 2440
         #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -2459,19 +2445,7 @@ static void homeaxis(AxisEnum axis) {
2459 2445
         #endif
2460 2446
         line_to_destination();
2461 2447
         stepper.synchronize();
2462
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2463
-          if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
2464
-        #endif
2465
-        endstops.enable(true); // Enable endstops for next homing move
2466 2448
       }
2467
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
2468
-        else {
2469
-          if (DEBUGGING(LEVELING)) {
2470
-            SERIAL_ECHOPAIR("> endstop_adj * axis_home_dir = ", endstop_adj[axis] * axis_home_dir);
2471
-            SERIAL_EOL;
2472
-          }
2473
-        }
2474
-      #endif
2475 2449
     #endif
2476 2450
 
2477 2451
     // Set the axis position to its home position (plus home offsets)
@@ -2840,7 +2814,11 @@ inline void gcode_G28() {
2840 2814
   #endif
2841 2815
 
2842 2816
   setup_for_endstop_or_probe_move();
2843
-  endstops.enable();
2817
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
2818
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
2819
+  #endif
2820
+  endstops.enable(true); // Enable endstops for next homing move
2821
+
2844 2822
 
2845 2823
   #if ENABLED(DELTA)
2846 2824
     /**
@@ -3061,7 +3039,11 @@ inline void gcode_G28() {
3061 3039
 
3062 3040
   #endif // !DELTA (gcode_G28)
3063 3041
 
3042
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
3043
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.not_homing()");
3044
+  #endif
3064 3045
   endstops.not_homing();
3046
+  endstops.hit_on_purpose(); // clear endstop hit flags
3065 3047
 
3066 3048
   // Enable mesh leveling again
3067 3049
   #if ENABLED(MESH_BED_LEVELING)
@@ -3101,8 +3083,6 @@ inline void gcode_G28() {
3101 3083
 
3102 3084
   clean_up_after_endstop_or_probe_move();
3103 3085
 
3104
-  endstops.hit_on_purpose(); // clear endstop hit flags
3105
-
3106 3086
   #if ENABLED(DEBUG_LEVELING_FEATURE)
3107 3087
     if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G28");
3108 3088
   #endif

Loading…
Cancel
Save