Browse Source

Patch the end of G29 to sync plan position

Scott Lahteine 8 years ago
parent
commit
c8c57e59fc
1 changed files with 6 additions and 8 deletions
  1. 6
    8
      Marlin/Marlin_main.cpp

+ 6
- 8
Marlin/Marlin_main.cpp View File

@@ -3710,8 +3710,7 @@ inline void gcode_G28() {
3710 3710
     if (!dryrun) {
3711 3711
       // Re-orient the current position without leveling
3712 3712
       // based on where the steppers are positioned.
3713
-      get_cartesian_from_steppers();
3714
-      memcpy(current_position, cartes, sizeof(cartes));
3713
+      set_current_from_steppers_for_axis(ALL_AXES);
3715 3714
 
3716 3715
       // Sync the planner to where the steppers stopped
3717 3716
       planner.sync_from_steppers();
@@ -4051,9 +4050,6 @@ inline void gcode_G28() {
4051 4050
         #if ENABLED(DEBUG_LEVELING_FEATURE)
4052 4051
           if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position);
4053 4052
         #endif
4054
-
4055
-        SYNC_PLAN_POSITION_KINEMATIC();
4056
-        abl_should_enable = true;
4057 4053
       }
4058 4054
 
4059 4055
     #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -4063,14 +4059,13 @@ inline void gcode_G28() {
4063 4059
           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("G29 uncorrected Z:", current_position[Z_AXIS]);
4064 4060
         #endif
4065 4061
 
4062
+        // Unapply the offset because it is going to be immediately applied
4063
+        // and cause compensation movement in Z
4066 4064
         current_position[Z_AXIS] -= bilinear_z_offset(current_position);
4067 4065
 
4068 4066
         #if ENABLED(DEBUG_LEVELING_FEATURE)
4069 4067
           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR(" corrected Z:", current_position[Z_AXIS]);
4070 4068
         #endif
4071
-
4072
-        SYNC_PLAN_POSITION_KINEMATIC();
4073
-        abl_should_enable = true;
4074 4069
       }
4075 4070
 
4076 4071
     #endif // ABL_PLANAR
@@ -4093,6 +4088,9 @@ inline void gcode_G28() {
4093 4088
 
4094 4089
     // Auto Bed Leveling is complete! Enable if possible.
4095 4090
     planner.abl_enabled = dryrun ? abl_should_enable : true;
4091
+
4092
+    if (planner.abl_enabled)
4093
+      SYNC_PLAN_POSITION_KINEMATIC();
4096 4094
   }
4097 4095
 
4098 4096
 #endif // HAS_ABL

Loading…
Cancel
Save