Browse Source

Simpler cleanup in G28 / G29

Scott Lahteine 9 years ago
parent
commit
7da3080761
1 changed files with 16 additions and 22 deletions
  1. 16
    22
      Marlin/Marlin_main.cpp

+ 16
- 22
Marlin/Marlin_main.cpp View File

1607
   endstops.enable();
1607
   endstops.enable();
1608
 }
1608
 }
1609
 
1609
 
1610
+static void clean_up_after_endstop_or_probe_move() {
1611
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
1612
+    if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
1613
+  #endif
1614
+  feedrate = saved_feedrate;
1615
+  feedrate_multiplier = saved_feedrate_multiplier;
1616
+  refresh_cmd_timeout();
1617
+}
1618
+
1610
 #if HAS_BED_PROBE
1619
 #if HAS_BED_PROBE
1611
 
1620
 
1612
-  static void clean_up_after_endstop_or_probe_move() {
1613
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
1614
-      if (DEBUGGING(LEVELING)) DEBUG_POS("clean_up_after_endstop_or_probe_move", current_position);
1615
-    #endif
1616
-    feedrate = saved_feedrate;
1617
-    feedrate_multiplier = saved_feedrate_multiplier;
1618
-    refresh_cmd_timeout();
1619
-  }
1620
   static void clean_up_after_endstop_move() {
1621
   static void clean_up_after_endstop_move() {
1621
     clean_up_after_endstop_or_probe_move();
1622
     clean_up_after_endstop_or_probe_move();
1622
     endstops.not_homing();
1623
     endstops.not_homing();
3058
 
3059
 
3059
   #endif // !DELTA (gcode_G28)
3060
   #endif // !DELTA (gcode_G28)
3060
 
3061
 
3061
-  #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
3062
-    endstops.enable(false);
3063
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
3064
-      if (DEBUGGING(LEVELING)) {
3065
-        SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING endstops.enable(false)");
3066
-      }
3067
-    #endif
3068
-  #endif
3062
+  endstops.not_homing();
3069
 
3063
 
3070
   // Enable mesh leveling again
3064
   // Enable mesh leveling again
3071
   #if ENABLED(MESH_BED_LEVELING)
3065
   #if ENABLED(MESH_BED_LEVELING)
3097
     }
3091
     }
3098
   #endif
3092
   #endif
3099
 
3093
 
3100
-  feedrate = saved_feedrate;
3101
-  feedrate_multiplier = saved_feedrate_multiplier;
3102
-  refresh_cmd_timeout();
3094
+  clean_up_after_endstop_or_probe_move();
3095
+
3103
   endstops.hit_on_purpose(); // clear endstop hit flags
3096
   endstops.hit_on_purpose(); // clear endstop hit flags
3104
 
3097
 
3105
   #if ENABLED(DEBUG_LEVELING_FEATURE)
3098
   #if ENABLED(DEBUG_LEVELING_FEATURE)
3597
         if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
3590
         if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
3598
       #endif
3591
       #endif
3599
 
3592
 
3600
-      clean_up_after_endstop_or_probe_move();
3601
-
3602
       #if ENABLED(DELTA)
3593
       #if ENABLED(DELTA)
3603
 
3594
 
3604
         if (!dryrun) extrapolate_unprobed_bed_level();
3595
         if (!dryrun) extrapolate_unprobed_bed_level();
3725
                                   ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3716
                                   ABL_PROBE_PT_3_Y + home_offset[Y_AXIS],
3726
                                   current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,
3717
                                   current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS,
3727
                                   p3, verbose_level);
3718
                                   p3, verbose_level);
3728
-      clean_up_after_endstop_or_probe_move();
3719
+
3729
       if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3720
       if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
3730
 
3721
 
3731
     #endif // !AUTO_BED_LEVELING_GRID
3722
     #endif // !AUTO_BED_LEVELING_GRID
3807
     // Stow the probe. Servo will raise if needed.
3798
     // Stow the probe. Servo will raise if needed.
3808
     stow_z_probe();
3799
     stow_z_probe();
3809
 
3800
 
3801
+    // Restore state after probing
3802
+    clean_up_after_endstop_or_probe_move();
3803
+
3810
     #ifdef Z_PROBE_END_SCRIPT
3804
     #ifdef Z_PROBE_END_SCRIPT
3811
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3805
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3812
         if (DEBUGGING(LEVELING)) {
3806
         if (DEBUGGING(LEVELING)) {

Loading…
Cancel
Save