Browse Source

Remove offsets from soft endstops, tool change

Scott Lahteine 7 years ago
parent
commit
549c814e8d
1 changed files with 11 additions and 28 deletions
  1. 11
    28
      Marlin/Marlin_main.cpp

+ 11
- 28
Marlin/Marlin_main.cpp View File

1405
    * at the same positions relative to the machine.
1405
    * at the same positions relative to the machine.
1406
    */
1406
    */
1407
   void update_software_endstops(const AxisEnum axis) {
1407
   void update_software_endstops(const AxisEnum axis) {
1408
-    const float offs = 0.0
1409
-      #if HAS_HOME_OFFSET
1410
-        + home_offset[axis]
1411
-      #endif
1412
-      #if HAS_POSITION_SHIFT
1413
-        + position_shift[axis]
1414
-      #endif
1415
-    ;
1416
-
1417
     #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
1408
     #if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
1418
-      workspace_offset[axis] = offs;
1409
+      workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1419
     #endif
1410
     #endif
1420
 
1411
 
1421
     #if ENABLED(DUAL_X_CARRIAGE)
1412
     #if ENABLED(DUAL_X_CARRIAGE)
1426
 
1417
 
1427
         if (active_extruder != 0) {
1418
         if (active_extruder != 0) {
1428
           // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
1419
           // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
1429
-          soft_endstop_min[X_AXIS] = X2_MIN_POS + offs;
1430
-          soft_endstop_max[X_AXIS] = dual_max_x + offs;
1420
+          soft_endstop_min[X_AXIS] = X2_MIN_POS;
1421
+          soft_endstop_max[X_AXIS] = dual_max_x;
1431
         }
1422
         }
1432
         else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1423
         else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1433
           // In Duplication Mode, T0 can move as far left as X_MIN_POS
1424
           // In Duplication Mode, T0 can move as far left as X_MIN_POS
1434
           // but not so far to the right that T1 would move past the end
1425
           // but not so far to the right that T1 would move past the end
1435
-          soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
1436
-          soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
1426
+          soft_endstop_min[X_AXIS] = base_min_pos(X_AXIS);
1427
+          soft_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset);
1437
         }
1428
         }
1438
         else {
1429
         else {
1439
           // In other modes, T0 can move from X_MIN_POS to X_MAX_POS
1430
           // In other modes, T0 can move from X_MIN_POS to X_MAX_POS
1440
-          soft_endstop_min[axis] = base_min_pos(axis) + offs;
1441
-          soft_endstop_max[axis] = base_max_pos(axis) + offs;
1431
+          soft_endstop_min[axis] = base_min_pos(axis);
1432
+          soft_endstop_max[axis] = base_max_pos(axis);
1442
         }
1433
         }
1443
       }
1434
       }
1444
     #elif ENABLED(DELTA)
1435
     #elif ENABLED(DELTA)
1445
-      soft_endstop_min[axis] = base_min_pos(axis) + offs;
1446
-      soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height : base_max_pos(axis)) + offs;
1436
+      soft_endstop_min[axis] = base_min_pos(axis);
1437
+      soft_endstop_max[axis] = axis == Z_AXIS ? delta_height : base_max_pos(axis);
1447
     #else
1438
     #else
1448
-      soft_endstop_min[axis] = base_min_pos(axis) + offs;
1449
-      soft_endstop_max[axis] = base_max_pos(axis) + offs;
1439
+      soft_endstop_min[axis] = base_min_pos(axis);
1440
+      soft_endstop_max[axis] = base_max_pos(axis);
1450
     #endif
1441
     #endif
1451
 
1442
 
1452
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1443
     #if ENABLED(DEBUG_LEVELING_FEATURE)
11143
           // The newly-selected extruder XY is actually at...
11134
           // The newly-selected extruder XY is actually at...
11144
           current_position[X_AXIS] += xydiff[X_AXIS];
11135
           current_position[X_AXIS] += xydiff[X_AXIS];
11145
           current_position[Y_AXIS] += xydiff[Y_AXIS];
11136
           current_position[Y_AXIS] += xydiff[Y_AXIS];
11146
-          #if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE) || ENABLED(PARKING_EXTRUDER)
11147
-            for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
11148
-              #if HAS_POSITION_SHIFT
11149
-                position_shift[i] += xydiff[i];
11150
-              #endif
11151
-              update_software_endstops((AxisEnum)i);
11152
-            }
11153
-          #endif
11154
 
11137
 
11155
           // Set the new active extruder
11138
           // Set the new active extruder
11156
           active_extruder = tmp_extruder;
11139
           active_extruder = tmp_extruder;

Loading…
Cancel
Save