浏览代码

Revive SCARA's home offset (unimplemented)

Scott Lahteine 6 年前
父节点
当前提交
d1ff22b983

+ 30
- 19
Marlin/src/gcode/calibrate/M665.cpp 查看文件

@@ -66,32 +66,43 @@
66 66
    *   S[segments-per-second] - Segments-per-second
67 67
    *   P[theta-psi-offset]    - Theta-Psi offset, added to the shoulder (A/X) angle
68 68
    *   T[theta-offset]        - Theta     offset, added to the elbow    (B/Y) angle
69
+   *   Z[z-offset]            - Z offset, added to Z
69 70
    *
70 71
    *   A, P, and X are all aliases for the shoulder angle
71 72
    *   B, T, and Y are all aliases for the elbow angle
72 73
    */
73 74
   void GcodeSuite::M665() {
74
-    if (parser.seen('S')) delta_segments_per_second = parser.value_float();
75
+    if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
75 76
 
76
-    const bool hasA = parser.seen('A'), hasP = parser.seen('P'), hasX = parser.seen('X');
77
-    const uint8_t sumAPX = hasA + hasP + hasX;
78
-    if (sumAPX == 1)
79
-      home_offset[A_AXIS] = parser.value_float();
80
-    else if (sumAPX > 1) {
81
-      SERIAL_ERROR_START();
82
-      SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
83
-      return;
84
-    }
77
+    #if HAS_SCARA_OFFSET
85 78
 
86
-    const bool hasB = parser.seen('B'), hasT = parser.seen('T'), hasY = parser.seen('Y');
87
-    const uint8_t sumBTY = hasB + hasT + hasY;
88
-    if (sumBTY == 1)
89
-      home_offset[B_AXIS] = parser.value_float();
90
-    else if (sumBTY > 1) {
91
-      SERIAL_ERROR_START();
92
-      SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
93
-      return;
94
-    }
79
+      if (parser.seenval('Z')) scara_home_offset[Z_AXIS] = parser.value_linear_units();
80
+
81
+      const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X');
82
+      const uint8_t sumAPX = hasA + hasP + hasX;
83
+      if (sumAPX) {
84
+        if (sumAPX == 1)
85
+          scara_home_offset[A_AXIS] = parser.value_float();
86
+        else {
87
+          SERIAL_ERROR_START();
88
+          SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
89
+          return;
90
+        }
91
+      }
92
+
93
+      const bool hasB = parser.seenval('B'), hasT = parser.seenval('T'), hasY = parser.seenval('Y');
94
+      const uint8_t sumBTY = hasB + hasT + hasY;
95
+      if (sumBTY) {
96
+        if (sumBTY == 1)
97
+          scara_home_offset[B_AXIS] = parser.value_float();
98
+        else {
99
+          SERIAL_ERROR_START();
100
+          SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
101
+          return;
102
+        }
103
+      }
104
+
105
+    #endif // HAS_SCARA_OFFSET
95 106
   }
96 107
 
97 108
 #endif

+ 6
- 0
Marlin/src/gcode/control/M211.cpp 查看文件

@@ -20,6 +20,10 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfigPre.h"
24
+
25
+#if HAS_SOFTWARE_ENDSTOPS
26
+
23 27
 #include "../gcode.h"
24 28
 #include "../../module/motion.h"
25 29
 
@@ -46,3 +50,5 @@ void GcodeSuite::M211() {
46 50
   SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_max[Y_AXIS]));
47 51
   SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_max[Z_AXIS]));
48 52
 }
53
+
54
+#endif

+ 3
- 1
Marlin/src/gcode/gcode.cpp 查看文件

@@ -483,7 +483,9 @@ void GcodeSuite::process_parsed_command(
483 483
         #endif
484 484
       #endif
485 485
 
486
-      case 211: M211(); break;                                    // M211: Enable, Disable, and/or Report software endstops
486
+      #if HAS_SOFTWARE_ENDSTOPS
487
+        case 211: M211(); break;                                  // M211: Enable, Disable, and/or Report software endstops
488
+      #endif
487 489
 
488 490
       #if EXTRUDERS > 1
489 491
         case 217: M217(); break;                                  // M217: Set filament swap parameters

+ 1
- 1
Marlin/src/gcode/geometry/G53-G59.cpp 查看文件

@@ -44,7 +44,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
44 44
     const float diff = new_offset[i] - old_offset[i];
45 45
     if (diff) {
46 46
       position_shift[i] += diff;
47
-      update_software_endstops((AxisEnum)i);
47
+      update_workspace_offset((AxisEnum)i);
48 48
     }
49 49
   }
50 50
   return true;

+ 2
- 2
Marlin/src/gcode/geometry/G92.cpp 查看文件

@@ -42,7 +42,7 @@ void GcodeSuite::G92() {
42 42
             const float v = position_shift[i];
43 43
             if (v) {
44 44
               position_shift[i] = 0;
45
-              update_software_endstops((AxisEnum)i);
45
+              update_workspace_offset((AxisEnum)i);
46 46
             }
47 47
           }
48 48
         #endif // Not SCARA
@@ -79,7 +79,7 @@ void GcodeSuite::G92() {
79 79
           }
80 80
           else {
81 81
             position_shift[i] += d;       // Other axes simply offset the coordinate space
82
-            update_software_endstops((AxisEnum)i);
82
+            update_workspace_offset((AxisEnum)i);
83 83
           }
84 84
         #endif
85 85
       }

+ 3
- 1
Marlin/src/inc/Conditionals_post.h 查看文件

@@ -1527,7 +1527,9 @@
1527 1527
 // Updated G92 behavior shifts the workspace
1528 1528
 #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
1529 1529
 // The home offset also shifts the coordinate space
1530
-#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && (IS_SCARA || IS_CARTESIAN))
1530
+#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_CARTESIAN)
1531
+// The SCARA home offset applies only on G28
1532
+#define HAS_SCARA_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_SCARA)
1531 1533
 // Cumulative offset to workspace to save some calculation
1532 1534
 #define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET)
1533 1535
 // M206 sets the home offset for Cartesian machines

+ 2
- 2
Marlin/src/lcd/extensible_ui/ui_api.cpp 查看文件

@@ -200,7 +200,7 @@ namespace UI {
200 200
           max = current_position[axis] + 1000;
201 201
 
202 202
     // Limit to software endstops, if enabled
203
-    #if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
203
+    #if HAS_SOFTWARE_ENDSTOPS
204 204
       if (soft_endstops_enabled) switch (axis) {
205 205
         case X_AXIS:
206 206
           #if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
@@ -227,7 +227,7 @@ namespace UI {
227 227
           #endif
228 228
         default: break;
229 229
       }
230
-    #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
230
+    #endif // HAS_SOFTWARE_ENDSTOPS
231 231
 
232 232
     // Delta limits XY based on the current offset from center
233 233
     // This assumes the center is 0,0

+ 2
- 2
Marlin/src/lcd/menu/menu_motion.cpp 查看文件

@@ -88,7 +88,7 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) {
88 88
           max = current_position[axis] + 1000;
89 89
 
90 90
     // Limit to software endstops, if enabled
91
-    #if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
91
+    #if HAS_SOFTWARE_ENDSTOPS
92 92
       if (soft_endstops_enabled) switch (axis) {
93 93
         case X_AXIS:
94 94
           #if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
@@ -115,7 +115,7 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) {
115 115
           #endif
116 116
         default: break;
117 117
       }
118
-    #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
118
+    #endif // HAS_SOFTWARE_ENDSTOPS
119 119
 
120 120
     // Delta limits XY based on the current offset from center
121 121
     // This assumes the center is 0,0

+ 38
- 14
Marlin/src/module/configuration_store.cpp 查看文件

@@ -124,7 +124,7 @@ typedef struct SettingsDataStruct {
124 124
   float planner_max_jerk[XYZE],                         // M205 XYZE  planner.max_jerk[XYZE]
125 125
         planner_junction_deviation_mm;                  // M205 J     planner.junction_deviation_mm
126 126
 
127
-  float home_offset[XYZ];                               // M206 XYZ
127
+  float home_offset[XYZ];                               // M206 XYZ / M665 TPZ
128 128
 
129 129
   #if HAS_HOTEND_OFFSET
130 130
     float hotend_offset[XYZ][HOTENDS - 1];              // M218 XYZ
@@ -309,10 +309,11 @@ void MarlinSettings::postprocess() {
309 309
       planner.refresh_e_factor(i);
310 310
   #endif
311 311
 
312
-  #if HAS_HOME_OFFSET || ENABLED(DUAL_X_CARRIAGE)
313
-    // Software endstops depend on home_offset
314
-    LOOP_XYZ(i) update_software_endstops((AxisEnum)i);
315
-  #endif
312
+  // Software endstops depend on home_offset
313
+  LOOP_XYZ(i) {
314
+    update_workspace_offset((AxisEnum)i);
315
+    update_software_endstops((AxisEnum)i);
316
+  }
316 317
 
317 318
   #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
318 319
     set_z_fade_height(new_z_fade_height, false); // false = no report
@@ -453,10 +454,14 @@ void MarlinSettings::postprocess() {
453 454
 
454 455
     _FIELD_TEST(home_offset);
455 456
 
456
-    #if !HAS_HOME_OFFSET
457
-      const float home_offset[XYZ] = { 0 };
457
+    #if HAS_SCARA_OFFSET
458
+      EEPROM_WRITE(scara_home_offset);
459
+    #else
460
+      #if !HAS_HOME_OFFSET
461
+        const float home_offset[XYZ] = { 0 };
462
+      #endif
463
+      EEPROM_WRITE(home_offset);
458 464
     #endif
459
-    EEPROM_WRITE(home_offset);
460 465
 
461 466
     #if HAS_HOTEND_OFFSET
462 467
       // Skip hotend 0 which must be 0
@@ -1062,15 +1067,19 @@ void MarlinSettings::postprocess() {
1062 1067
       }
1063 1068
 
1064 1069
       //
1065
-      // Home Offset (M206)
1070
+      // Home Offset (M206 / M665)
1066 1071
       //
1067 1072
       {
1068 1073
         _FIELD_TEST(home_offset);
1069 1074
 
1070
-        #if !HAS_HOME_OFFSET
1071
-          float home_offset[XYZ];
1075
+        #if HAS_SCARA_OFFSET
1076
+          EEPROM_READ(scara_home_offset);
1077
+        #else
1078
+          #if !HAS_HOME_OFFSET
1079
+            float home_offset[XYZ];
1080
+          #endif
1081
+          EEPROM_READ(home_offset);
1072 1082
         #endif
1073
-        EEPROM_READ(home_offset);
1074 1083
       }
1075 1084
 
1076 1085
       //
@@ -1826,7 +1835,9 @@ void MarlinSettings::reset(PORTARG_SOLO) {
1826 1835
     planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM);
1827 1836
   #endif
1828 1837
 
1829
-  #if HAS_HOME_OFFSET
1838
+  #if HAS_SCARA_OFFSET
1839
+    ZERO(scara_home_offset);
1840
+  #elif HAS_HOME_OFFSET
1830 1841
     ZERO(home_offset);
1831 1842
   #endif
1832 1843
 
@@ -2430,7 +2441,20 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2430 2441
 
2431 2442
     #endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
2432 2443
 
2433
-    #if ENABLED(DELTA)
2444
+    #if HAS_SCARA_OFFSET
2445
+
2446
+      if (!forReplay) {
2447
+        CONFIG_ECHO_START;
2448
+        SERIAL_ECHOLNPGM_P(port, "SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
2449
+      }
2450
+      CONFIG_ECHO_START;
2451
+      SERIAL_ECHOPAIR_P(port, "  M665 S", delta_segments_per_second);
2452
+      SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]);
2453
+      SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]);
2454
+      SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(scara_home_offset[Z_AXIS]));
2455
+      SERIAL_EOL_P(port);
2456
+
2457
+    #elif ENABLED(DELTA)
2434 2458
 
2435 2459
       if (!forReplay) {
2436 2460
         CONFIG_ECHO_START;

+ 89
- 85
Marlin/src/module/motion.cpp 查看文件

@@ -129,11 +129,14 @@ const float homing_feedrate_mm_s[4] PROGMEM = {
129 129
 // Cartesian conversion result goes here:
130 130
 float cartes[XYZ];
131 131
 
132
-// Until kinematics.cpp is created, create this here
133 132
 #if IS_KINEMATIC
134 133
   float delta[ABC];
135 134
 #endif
136 135
 
136
+#if HAS_SCARA_OFFSET
137
+  float scara_home_offset[ABC];
138
+#endif
139
+
137 140
 /**
138 141
  * The workspace can be offset by some commands, or
139 142
  * these offsets may be omitted to save on computation.
@@ -452,15 +455,14 @@ void bracket_probe_move(const bool before) {
452 455
 void setup_for_endstop_or_probe_move() { bracket_probe_move(true); }
453 456
 void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); }
454 457
 
455
-// Software Endstops are based on the configured limits.
456
-float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
457
-      soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS };
458
-
459 458
 #if HAS_SOFTWARE_ENDSTOPS
460 459
 
461
-  // Software Endstops are based on the configured limits.
462 460
   bool soft_endstops_enabled = true;
463 461
 
462
+  // Software Endstops are based on the configured limits.
463
+  float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
464
+        soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS };
465
+
464 466
   #if IS_KINEMATIC
465 467
     float soft_endstop_radius, soft_endstop_radius_2;
466 468
   #endif
@@ -502,6 +504,79 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
502 504
     #endif
503 505
   }
504 506
 
507
+  /**
508
+   * Software endstops can be used to monitor the open end of
509
+   * an axis that has a hardware endstop on the other end. Or
510
+   * they can prevent axes from moving past endstops and grinding.
511
+   *
512
+   * To keep doing their job as the coordinate system changes,
513
+   * the software endstop positions must be refreshed to remain
514
+   * at the same positions relative to the machine.
515
+   */
516
+  void update_software_endstops(const AxisEnum axis) {
517
+
518
+    #if ENABLED(DUAL_X_CARRIAGE)
519
+
520
+      if (axis == X_AXIS) {
521
+
522
+        // In Dual X mode hotend_offset[X] is T1's home position
523
+        const float dual_max_x = MAX(hotend_offset[X_AXIS][1], X2_MAX_POS);
524
+
525
+        if (active_extruder != 0) {
526
+          // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
527
+          soft_endstop_min[X_AXIS] = X2_MIN_POS;
528
+          soft_endstop_max[X_AXIS] = dual_max_x;
529
+        }
530
+        else if (dxc_is_duplicating()) {
531
+          // In Duplication Mode, T0 can move as far left as X1_MIN_POS
532
+          // but not so far to the right that T1 would move past the end
533
+          soft_endstop_min[X_AXIS] = X1_MIN_POS;
534
+          soft_endstop_max[X_AXIS] = MIN(X1_MAX_POS, dual_max_x - duplicate_extruder_x_offset);
535
+        }
536
+        else {
537
+          // In other modes, T0 can move from X1_MIN_POS to X1_MAX_POS
538
+          soft_endstop_min[X_AXIS] = X1_MIN_POS;
539
+          soft_endstop_max[X_AXIS] = X1_MAX_POS;
540
+        }
541
+      }
542
+
543
+    #elif ENABLED(DELTA)
544
+
545
+      soft_endstop_min[axis] = base_min_pos(axis);
546
+      soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height
547
+      #if HAS_BED_PROBE
548
+        - zprobe_zoffset + Z_PROBE_OFFSET_FROM_EXTRUDER
549
+      #endif
550
+      : base_max_pos(axis));
551
+
552
+      switch (axis) {
553
+        case X_AXIS:
554
+        case Y_AXIS:
555
+          // Get a minimum radius for clamping
556
+          soft_endstop_radius = MIN(ABS(MAX(soft_endstop_min[X_AXIS], soft_endstop_min[Y_AXIS])), soft_endstop_max[X_AXIS], soft_endstop_max[Y_AXIS]);
557
+          soft_endstop_radius_2 = sq(soft_endstop_radius);
558
+          break;
559
+        case Z_AXIS:
560
+          delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
561
+        default: break;
562
+      }
563
+
564
+    #else
565
+
566
+      soft_endstop_min[axis] = base_min_pos(axis);
567
+      soft_endstop_max[axis] = base_max_pos(axis);
568
+
569
+    #endif
570
+
571
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
572
+      if (DEBUGGING(LEVELING)) {
573
+        SERIAL_ECHOPAIR("For ", axis_codes[axis]);
574
+        SERIAL_ECHOPAIR(" axis:\n soft_endstop_min = ", soft_endstop_min[axis]);
575
+        SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
576
+      }
577
+    #endif
578
+  }
579
+
505 580
 #endif
506 581
 
507 582
 #if !UBL_SEGMENTED
@@ -1154,7 +1229,7 @@ void set_axis_is_at_home(const AxisEnum axis) {
1154 1229
 
1155 1230
   #if HAS_POSITION_SHIFT
1156 1231
     position_shift[axis] = 0;
1157
-    update_software_endstops(axis);
1232
+    update_workspace_offset(axis);
1158 1233
   #endif
1159 1234
 
1160 1235
   #if ENABLED(DUAL_X_CARRIAGE)
@@ -1504,89 +1579,18 @@ void homeaxis(const AxisEnum axis) {
1504 1579
   #endif
1505 1580
 } // homeaxis()
1506 1581
 
1507
-#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
1508
-
1509
-  /**
1510
-   * Software endstops can be used to monitor the open end of
1511
-   * an axis that has a hardware endstop on the other end. Or
1512
-   * they can prevent axes from moving past endstops and grinding.
1513
-   *
1514
-   * To keep doing their job as the coordinate system changes,
1515
-   * the software endstop positions must be refreshed to remain
1516
-   * at the same positions relative to the machine.
1517
-   */
1518
-  void update_software_endstops(const AxisEnum axis) {
1519
-    #if HAS_HOME_OFFSET
1520
-      workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1521
-    #endif
1522
-
1523
-    #if ENABLED(DUAL_X_CARRIAGE)
1524
-      if (axis == X_AXIS) {
1525
-
1526
-        // In Dual X mode hotend_offset[X] is T1's home position
1527
-        const float dual_max_x = MAX(hotend_offset[X_AXIS][1], X2_MAX_POS);
1528
-
1529
-        if (active_extruder != 0) {
1530
-          // T1 can move from X2_MIN_POS to X2_MAX_POS or X2 home position (whichever is larger)
1531
-          soft_endstop_min[X_AXIS] = X2_MIN_POS;
1532
-          soft_endstop_max[X_AXIS] = dual_max_x;
1533
-        }
1534
-        else if (dxc_is_duplicating()) {
1535
-          // In Duplication Mode, T0 can move as far left as X1_MIN_POS
1536
-          // but not so far to the right that T1 would move past the end
1537
-          soft_endstop_min[X_AXIS] = X1_MIN_POS;
1538
-          soft_endstop_max[X_AXIS] = MIN(X1_MAX_POS, dual_max_x - duplicate_extruder_x_offset);
1539
-        }
1540
-        else {
1541
-          // In other modes, T0 can move from X1_MIN_POS to X1_MAX_POS
1542
-          soft_endstop_min[X_AXIS] = X1_MIN_POS;
1543
-          soft_endstop_max[X_AXIS] = X1_MAX_POS;
1544
-        }
1545
-      }
1546
-    #elif ENABLED(DELTA)
1547
-      soft_endstop_min[axis] = base_min_pos(axis);
1548
-      soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height
1549
-      #if HAS_BED_PROBE
1550
-        - zprobe_zoffset + Z_PROBE_OFFSET_FROM_EXTRUDER
1551
-      #endif
1552
-      : base_max_pos(axis));
1553
-    #else
1554
-      soft_endstop_min[axis] = base_min_pos(axis);
1555
-      soft_endstop_max[axis] = base_max_pos(axis);
1556
-    #endif
1557
-
1582
+#if HAS_WORKSPACE_OFFSET
1583
+  void update_workspace_offset(const AxisEnum axis) {
1584
+    workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1558 1585
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1559 1586
       if (DEBUGGING(LEVELING)) {
1560 1587
         SERIAL_ECHOPAIR("For ", axis_codes[axis]);
1561
-        #if HAS_HOME_OFFSET
1562
-          SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
1563
-        #endif
1564
-        #if HAS_POSITION_SHIFT
1565
-          SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]);
1566
-        #endif
1567
-        SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]);
1568
-        SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]);
1569
-      }
1570
-    #endif
1571
-
1572
-    #if ENABLED(DELTA)
1573
-      switch (axis) {
1574
-        #if HAS_SOFTWARE_ENDSTOPS
1575
-          case X_AXIS:
1576
-          case Y_AXIS:
1577
-            // Get a minimum radius for clamping
1578
-            soft_endstop_radius = MIN(ABS(MAX(soft_endstop_min[X_AXIS], soft_endstop_min[Y_AXIS])), soft_endstop_max[X_AXIS], soft_endstop_max[Y_AXIS]);
1579
-            soft_endstop_radius_2 = sq(soft_endstop_radius);
1580
-            break;
1581
-        #endif
1582
-        case Z_AXIS:
1583
-          delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top();
1584
-        default: break;
1588
+        SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]);
1589
+        SERIAL_ECHOLNPAIR("\n position_shift = ", position_shift[axis]);
1585 1590
       }
1586 1591
     #endif
1587 1592
   }
1588
-
1589
-#endif // HAS_WORKSPACE_OFFSET || DUAL_X_CARRIAGE || DELTA
1593
+#endif
1590 1594
 
1591 1595
 #if HAS_M206_COMMAND
1592 1596
   /**
@@ -1595,6 +1599,6 @@ void homeaxis(const AxisEnum axis) {
1595 1599
    */
1596 1600
   void set_home_offset(const AxisEnum axis, const float v) {
1597 1601
     home_offset[axis] = v;
1598
-    update_software_endstops(axis);
1602
+    update_workspace_offset(axis);
1599 1603
   }
1600 1604
 #endif // HAS_M206_COMMAND

+ 15
- 6
Marlin/src/module/motion.h 查看文件

@@ -93,8 +93,6 @@ extern int16_t feedrate_percentage;
93 93
   extern float hotend_offset[XYZ][HOTENDS];
94 94
 #endif
95 95
 
96
-extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
97
-
98 96
 FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float(p); }
99 97
 FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); }
100 98
 
@@ -110,12 +108,23 @@ XYZ_DEFS(float, max_length,     MAX_LENGTH);
110 108
 XYZ_DEFS(float, home_bump_mm,   HOME_BUMP_MM);
111 109
 XYZ_DEFS(signed char, home_dir, HOME_DIR);
112 110
 
111
+#if HAS_WORKSPACE_OFFSET
112
+  void update_workspace_offset(const AxisEnum axis);
113
+#else
114
+  #define update_workspace_offset(x) NOOP
115
+#endif
116
+
113 117
 #if HAS_SOFTWARE_ENDSTOPS
114 118
   extern bool soft_endstops_enabled;
119
+  extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
115 120
   void clamp_to_software_endstops(float target[XYZ]);
121
+  void update_software_endstops(const AxisEnum axis);
116 122
 #else
117 123
   constexpr bool soft_endstops_enabled = false;
124
+  constexpr float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
125
+                  soft_endstop_max[XYZ] = { X_MAX_BED, Y_MAX_BED, Z_MAX_POS };
118 126
   #define clamp_to_software_endstops(x) NOOP
127
+  #define update_software_endstops(x) NOOP
119 128
 #endif
120 129
 
121 130
 void report_current_position();
@@ -252,6 +261,10 @@ void homeaxis(const AxisEnum axis);
252 261
     extern const float L1, L2;
253 262
   #endif
254 263
 
264
+  #if HAS_SCARA_OFFSET
265
+    extern float scara_home_offset[ABC]; // A and B angular offsets, Z mm offset
266
+  #endif
267
+
255 268
   // Return true if the given point is within the printable area
256 269
   inline bool position_is_reachable(const float &rx, const float &ry, const float inset=0) {
257 270
     #if ENABLED(DELTA)
@@ -354,10 +367,6 @@ void homeaxis(const AxisEnum axis);
354 367
 
355 368
 #endif
356 369
 
357
-#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE) || ENABLED(DELTA)
358
-  void update_software_endstops(const AxisEnum axis);
359
-#endif
360
-
361 370
 #if HAS_M206_COMMAND
362 371
   void set_home_offset(const AxisEnum axis, const float v);
363 372
 #endif

+ 1
- 6
Marlin/src/module/scara.cpp 查看文件

@@ -60,12 +60,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) {
60 60
 
61 61
     current_position[axis] = cartes[axis];
62 62
 
63
-    /**
64
-     * SCARA home positions are based on configuration since the actual
65
-     * limits are determined by the inverse kinematic transform.
66
-     */
67
-    soft_endstop_min[axis] = base_min_pos(axis); // + (cartes[axis] - base_home_pos(axis));
68
-    soft_endstop_max[axis] = base_max_pos(axis); // + (cartes[axis] - base_home_pos(axis));
63
+    update_software_endstops(axis);
69 64
   }
70 65
 }
71 66
 

+ 1
- 1
Marlin/src/module/tool_change.cpp 查看文件

@@ -623,7 +623,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
623 623
 
624 624
       feedrate_mm_s = old_feedrate_mm_s;
625 625
 
626
-      #if HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE)
626
+      #if ENABLED(DUAL_X_CARRIAGE)
627 627
         update_software_endstops(X_AXIS);
628 628
       #endif
629 629
 

正在加载...
取消
保存