Browse Source

Additional patches for gcode_T position change

Scott Lahteine 9 years ago
parent
commit
c9e536cf87
1 changed files with 27 additions and 21 deletions
  1. 27
    21
      Marlin/Marlin_main.cpp

+ 27
- 21
Marlin/Marlin_main.cpp View File

6497
     return;
6497
     return;
6498
   }
6498
   }
6499
 
6499
 
6500
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
6501
+    if (DEBUGGING(LEVELING)) {
6502
+      SERIAL_ECHOLNPGM(">>> gcode_T");
6503
+      DEBUG_POS("BEFORE", current_position);
6504
+    }
6505
+  #endif
6506
+
6500
   #if HOTENDS > 1
6507
   #if HOTENDS > 1
6501
 
6508
 
6502
     float old_feedrate = feedrate;
6509
     float old_feedrate = feedrate;
6579
         // Z software endstop. But this is technically correct (and
6586
         // Z software endstop. But this is technically correct (and
6580
         // there is no viable alternative).
6587
         // there is no viable alternative).
6581
         //
6588
         //
6582
-        float xydiff[2] = {
6583
-          hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
6584
-          hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
6585
-        };
6586
-
6587
         #if ENABLED(AUTO_BED_LEVELING_FEATURE)
6589
         #if ENABLED(AUTO_BED_LEVELING_FEATURE)
6588
           // Offset extruder, make sure to apply the bed level rotation matrix
6590
           // Offset extruder, make sure to apply the bed level rotation matrix
6589
           vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
6591
           vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
6596
 
6598
 
6597
           #if ENABLED(DEBUG_LEVELING_FEATURE)
6599
           #if ENABLED(DEBUG_LEVELING_FEATURE)
6598
             if (DEBUGGING(LEVELING)) {
6600
             if (DEBUGGING(LEVELING)) {
6599
-              SERIAL_ECHOLNPGM(">>> gcode_T");
6600
               tmp_offset_vec.debug("tmp_offset_vec");
6601
               tmp_offset_vec.debug("tmp_offset_vec");
6601
               act_offset_vec.debug("act_offset_vec");
6602
               act_offset_vec.debug("act_offset_vec");
6602
               offset_vec.debug("offset_vec (BEFORE)");
6603
               offset_vec.debug("offset_vec (BEFORE)");
6603
-              DEBUG_POS("BEFORE rotation", current_position);
6604
             }
6604
             }
6605
           #endif
6605
           #endif
6606
 
6606
 
6607
           offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix));
6607
           offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix));
6608
 
6608
 
6609
-          // Adjust the current position
6610
-          current_position[X_AXIS] += offset_vec.x;
6611
-          current_position[Y_AXIS] += offset_vec.y;
6612
-          current_position[Z_AXIS] += offset_vec.z;
6613
-
6614
           #if ENABLED(DEBUG_LEVELING_FEATURE)
6609
           #if ENABLED(DEBUG_LEVELING_FEATURE)
6615
-            if (DEBUGGING(LEVELING)) {
6616
-              offset_vec.debug("offset_vec (AFTER)");
6617
-              DEBUG_POS("AFTER rotation", current_position);
6618
-              SERIAL_ECHOLNPGM("<<< gcode_T");
6619
-            }
6610
+            if (DEBUGGING(LEVELING)) offset_vec.debug("offset_vec (AFTER)");
6620
           #endif
6611
           #endif
6621
 
6612
 
6613
+          // Adjustments to the current position
6614
+          float xydiff[2] = { offset_vec.x, offset_vec.y };
6615
+          current_position[Z_AXIS] += offset_vec.z;
6616
+
6622
         #else // !AUTO_BED_LEVELING_FEATURE
6617
         #else // !AUTO_BED_LEVELING_FEATURE
6623
 
6618
 
6619
+          float xydiff[2] = {
6620
+            hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
6621
+            hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
6622
+          };
6623
+
6624
           #if ENABLED(MESH_BED_LEVELING)
6624
           #if ENABLED(MESH_BED_LEVELING)
6625
 
6625
 
6626
             if (mbl.active()) {
6626
             if (mbl.active()) {
6631
 
6631
 
6632
           #endif // MESH_BED_LEVELING
6632
           #endif // MESH_BED_LEVELING
6633
 
6633
 
6634
-          // The newly-selected extruder XY is actually at...
6635
-          current_position[X_AXIS] += xydiff[X_AXIS];
6636
-          current_position[Y_AXIS] += xydiff[Y_AXIS];
6637
-
6638
         #endif // !AUTO_BED_LEVELING_FEATURE
6634
         #endif // !AUTO_BED_LEVELING_FEATURE
6639
 
6635
 
6636
+        // The newly-selected extruder XY is actually at...
6637
+        current_position[X_AXIS] += xydiff[X_AXIS];
6638
+        current_position[Y_AXIS] += xydiff[Y_AXIS];
6640
         for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
6639
         for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
6641
           position_shift[i] += xydiff[i];
6640
           position_shift[i] += xydiff[i];
6642
           update_software_endstops((AxisEnum)i);
6641
           update_software_endstops((AxisEnum)i);
6670
 
6669
 
6671
   #endif
6670
   #endif
6672
 
6671
 
6672
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
6673
+    if (DEBUGGING(LEVELING)) {
6674
+      DEBUG_POS("AFTER", current_position);
6675
+      SERIAL_ECHOLNPGM("<<< gcode_T");
6676
+    }
6677
+  #endif
6678
+
6673
   SERIAL_ECHO_START;
6679
   SERIAL_ECHO_START;
6674
   SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
6680
   SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
6675
   SERIAL_PROTOCOLLN((int)active_extruder);
6681
   SERIAL_PROTOCOLLN((int)active_extruder);

Loading…
Cancel
Save