Browse Source

MarkForged kinematics (#19235)

Victor Sokolov 4 years ago
parent
commit
e97e6865c3
No account linked to committer's email address

+ 2
- 1
Marlin/Configuration.h View File

608
 
608
 
609
 // @section machine
609
 // @section machine
610
 
610
 
611
-// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics
611
+// Enable one of the options below for CoreXY, CoreXZ, or CoreYZ kinematics,
612
 // either in the usual order or reversed
612
 // either in the usual order or reversed
613
 //#define COREXY
613
 //#define COREXY
614
 //#define COREXZ
614
 //#define COREXZ
616
 //#define COREYX
616
 //#define COREYX
617
 //#define COREZX
617
 //#define COREZX
618
 //#define COREZY
618
 //#define COREZY
619
+//#define MARKFORGED_XY  // MarkForged. See https://reprap.org/forum/read.php?152,504042
619
 
620
 
620
 //===========================================================================
621
 //===========================================================================
621
 //============================== Endstop Settings ===========================
622
 //============================== Endstop Settings ===========================

+ 5
- 4
Marlin/src/core/utility.cpp View File

57
 
57
 
58
   void log_machine_info() {
58
   void log_machine_info() {
59
     SERIAL_ECHOLNPGM("Machine Type: "
59
     SERIAL_ECHOLNPGM("Machine Type: "
60
-      TERN_(DELTA, "Delta")
61
-      TERN_(IS_SCARA, "SCARA")
62
-      TERN_(IS_CORE, "Core")
63
-      TERN_(IS_CARTESIAN, "Cartesian")
60
+      TERN_(DELTA,         "Delta")
61
+      TERN_(IS_SCARA,      "SCARA")
62
+      TERN_(IS_CORE,       "Core")
63
+      TERN_(MARKFORGED_XY, "MarkForged")
64
+      TERN_(IS_CARTESIAN,  "Cartesian")
64
     );
65
     );
65
 
66
 
66
     SERIAL_ECHOLNPGM("Probe: "
67
     SERIAL_ECHOLNPGM("Probe: "

+ 5
- 4
Marlin/src/gcode/host/M360.cpp View File

145
 
145
 
146
   config_prefix(PSTR("PrinterType"));
146
   config_prefix(PSTR("PrinterType"));
147
   SERIAL_ECHOLNPGM(
147
   SERIAL_ECHOLNPGM(
148
-    TERN_(DELTA,        "Delta")
149
-    TERN_(IS_SCARA,     "SCARA")
150
-    TERN_(IS_CORE,      "Core")
151
-    TERN_(IS_CARTESIAN, "Cartesian")
148
+    TERN_(DELTA,         "Delta")
149
+    TERN_(IS_SCARA,      "SCARA")
150
+    TERN_(IS_CORE,       "Core")
151
+    TERN_(MARKFORGED_XY, "MarkForged")
152
+    TERN_(IS_CARTESIAN,  "Cartesian")
152
   );
153
   );
153
 
154
 
154
   //
155
   //

+ 6
- 1
Marlin/src/inc/Conditionals_post.h View File

149
     #define CORE_AXIS_2 C_AXIS
149
     #define CORE_AXIS_2 C_AXIS
150
   #endif
150
   #endif
151
   #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n))
151
   #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n))
152
+#elif ENABLED(MARKFORGED_XY)
153
+  // Markforged kinematics
154
+  #define CORE_AXIS_1 A_AXIS
155
+  #define CORE_AXIS_2 B_AXIS
156
+  #define NORMAL_AXIS Z_AXIS
152
 #endif
157
 #endif
153
 
158
 
154
 // Calibration codes only for non-core axes
159
 // Calibration codes only for non-core axes
155
 #if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE)
160
 #if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE)
156
-  #if IS_CORE
161
+  #if EITHER(IS_CORE, MARKFORGED_XY)
157
     #define X_AXIS_INDEX 0
162
     #define X_AXIS_INDEX 0
158
     #define Y_AXIS_INDEX 1
163
     #define Y_AXIS_INDEX 1
159
     #define Z_AXIS_INDEX 2
164
     #define Z_AXIS_INDEX 2

+ 13
- 4
Marlin/src/inc/SanityCheck.h View File

764
 #if ENABLED(BABYSTEPPING)
764
 #if ENABLED(BABYSTEPPING)
765
   #if ENABLED(SCARA)
765
   #if ENABLED(SCARA)
766
     #error "BABYSTEPPING is not implemented for SCARA yet."
766
     #error "BABYSTEPPING is not implemented for SCARA yet."
767
+  #elif BOTH(MARKFORGED_XY, BABYSTEP_XY)
768
+    #error "BABYSTEPPING only implemented for Z axis on MarkForged."
767
   #elif BOTH(DELTA, BABYSTEP_XY)
769
   #elif BOTH(DELTA, BABYSTEP_XY)
768
     #error "BABYSTEPPING only implemented for Z axis on deltabots."
770
     #error "BABYSTEPPING only implemented for Z axis on deltabots."
769
   #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING)
771
   #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING)
1155
   + ENABLED(COREYZ) \
1157
   + ENABLED(COREYZ) \
1156
   + ENABLED(COREYX) \
1158
   + ENABLED(COREYX) \
1157
   + ENABLED(COREZX) \
1159
   + ENABLED(COREZX) \
1158
-  + ENABLED(COREZY)
1159
-  #error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, or COREZY."
1160
+  + ENABLED(COREZY) \
1161
+  + ENABLED(MARKFORGED_XY)
1162
+  #error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, or MARKFORGED_XY."
1160
 #endif
1163
 #endif
1161
 
1164
 
1162
 /**
1165
 /**
1576
 #if ENABLED(DUAL_X_CARRIAGE)
1579
 #if ENABLED(DUAL_X_CARRIAGE)
1577
   #if EXTRUDERS < 2
1580
   #if EXTRUDERS < 2
1578
     #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
1581
     #error "DUAL_X_CARRIAGE requires 2 (or more) extruders."
1579
-  #elif CORE_IS_XY || CORE_IS_XZ
1580
-    #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX."
1582
+  #elif ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
1583
+    #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, or MARKFORGED_XY."
1581
   #elif !GOOD_AXIS_PINS(X2)
1584
   #elif !GOOD_AXIS_PINS(X2)
1582
     #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
1585
     #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined."
1583
   #elif !HAS_X_MAX
1586
   #elif !HAS_X_MAX
2533
   #error "CoreXZ requires both X and Z to use sensorless homing if either one does."
2536
   #error "CoreXZ requires both X and Z to use sensorless homing if either one does."
2534
 #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
2537
 #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE
2535
   #error "CoreYZ requires both Y and Z to use sensorless homing if either one does."
2538
   #error "CoreYZ requires both Y and Z to use sensorless homing if either one does."
2539
+#elif ENABLED(MARKFORGED_XY) && X_SENSORLESS != Y_SENSORLESS
2540
+  #error "MARKFORGED_XY requires both X and Y to use sensorless homing if either one does."
2536
 #endif
2541
 #endif
2537
 
2542
 
2538
 // Other TMC feature requirements
2543
 // Other TMC feature requirements
2848
     #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM."
2853
     #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM."
2849
   #elif !defined(BACKLASH_CORRECTION)
2854
   #elif !defined(BACKLASH_CORRECTION)
2850
     #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION."
2855
     #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION."
2856
+  #elif ENABLED(MARKFORGED_XY)
2857
+    constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
2858
+    static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
2859
+                  "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system.");
2851
   #elif IS_CORE
2860
   #elif IS_CORE
2852
     constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
2861
     constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
2853
     static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
2862
     static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],

+ 6
- 6
Marlin/src/module/endstops.cpp View File

498
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
498
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
499
   #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
499
   #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
500
 
500
 
501
-  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
501
+  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
502
     // If G38 command is active check Z_MIN_PROBE for ALL movement
502
     // If G38 command is active check Z_MIN_PROBE for ALL movement
503
     if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
503
     if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
504
   #endif
504
   #endif
514
   #endif
514
   #endif
515
 
515
 
516
   // Use HEAD for core axes, AXIS for others
516
   // Use HEAD for core axes, AXIS for others
517
-  #if CORE_IS_XY || CORE_IS_XZ
517
+  #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
518
     #define X_AXIS_HEAD X_HEAD
518
     #define X_AXIS_HEAD X_HEAD
519
   #else
519
   #else
520
     #define X_AXIS_HEAD X_AXIS
520
     #define X_AXIS_HEAD X_AXIS
521
   #endif
521
   #endif
522
-  #if CORE_IS_XY || CORE_IS_YZ
522
+  #if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY)
523
     #define Y_AXIS_HEAD Y_HEAD
523
     #define Y_AXIS_HEAD Y_HEAD
524
   #else
524
   #else
525
     #define Y_AXIS_HEAD Y_AXIS
525
     #define Y_AXIS_HEAD Y_AXIS
736
     #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
736
     #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
737
   #endif
737
   #endif
738
 
738
 
739
-  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
739
+  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
740
     #if ENABLED(G38_PROBE_AWAY)
740
     #if ENABLED(G38_PROBE_AWAY)
741
       #define _G38_OPEN_STATE (G38_move >= 4)
741
       #define _G38_OPEN_STATE (G38_move >= 4)
742
     #else
742
     #else
865
     bool hit = false;
865
     bool hit = false;
866
     #if X_SPI_SENSORLESS
866
     #if X_SPI_SENSORLESS
867
       if (tmc_spi_homing.x && (stepperX.test_stall_status()
867
       if (tmc_spi_homing.x && (stepperX.test_stall_status()
868
-        #if CORE_IS_XY && Y_SPI_SENSORLESS
868
+        #if ANY(CORE_IS_XY, MARKFORGED_XY) && Y_SPI_SENSORLESS
869
           || stepperY.test_stall_status()
869
           || stepperY.test_stall_status()
870
         #elif CORE_IS_XZ && Z_SPI_SENSORLESS
870
         #elif CORE_IS_XZ && Z_SPI_SENSORLESS
871
           || stepperZ.test_stall_status()
871
           || stepperZ.test_stall_status()
877
     #endif
877
     #endif
878
     #if Y_SPI_SENSORLESS
878
     #if Y_SPI_SENSORLESS
879
       if (tmc_spi_homing.y && (stepperY.test_stall_status()
879
       if (tmc_spi_homing.y && (stepperY.test_stall_status()
880
-        #if CORE_IS_XY && X_SPI_SENSORLESS
880
+        #if ANY(CORE_IS_XY, MARKFORGED_XY) && X_SPI_SENSORLESS
881
           || stepperX.test_stall_status()
881
           || stepperX.test_stall_status()
882
         #elif CORE_IS_YZ && Z_SPI_SENSORLESS
882
         #elif CORE_IS_YZ && Z_SPI_SENSORLESS
883
           || stepperZ.test_stall_status()
883
           || stepperZ.test_stall_status()

+ 10
- 7
Marlin/src/module/motion.cpp View File

1152
           #if AXIS_HAS_STALLGUARD(X2)
1152
           #if AXIS_HAS_STALLGUARD(X2)
1153
             stealth_states.x2 = tmc_enable_stallguard(stepperX2);
1153
             stealth_states.x2 = tmc_enable_stallguard(stepperX2);
1154
           #endif
1154
           #endif
1155
-          #if CORE_IS_XY && Y_SENSORLESS
1155
+          #if EITHER(CORE_IS_XY, MARKFORGED_XY) && Y_SENSORLESS
1156
             stealth_states.y = tmc_enable_stallguard(stepperY);
1156
             stealth_states.y = tmc_enable_stallguard(stepperY);
1157
           #elif CORE_IS_XZ && Z_SENSORLESS
1157
           #elif CORE_IS_XZ && Z_SENSORLESS
1158
             stealth_states.z = tmc_enable_stallguard(stepperZ);
1158
             stealth_states.z = tmc_enable_stallguard(stepperZ);
1165
           #if AXIS_HAS_STALLGUARD(Y2)
1165
           #if AXIS_HAS_STALLGUARD(Y2)
1166
             stealth_states.y2 = tmc_enable_stallguard(stepperY2);
1166
             stealth_states.y2 = tmc_enable_stallguard(stepperY2);
1167
           #endif
1167
           #endif
1168
-          #if CORE_IS_XY && X_SENSORLESS
1168
+          #if EITHER(CORE_IS_XY, MARKFORGED_XY) && X_SENSORLESS
1169
             stealth_states.x = tmc_enable_stallguard(stepperX);
1169
             stealth_states.x = tmc_enable_stallguard(stepperX);
1170
           #elif CORE_IS_YZ && Z_SENSORLESS
1170
           #elif CORE_IS_YZ && Z_SENSORLESS
1171
             stealth_states.z = tmc_enable_stallguard(stepperZ);
1171
             stealth_states.z = tmc_enable_stallguard(stepperZ);
1216
           #if AXIS_HAS_STALLGUARD(X2)
1216
           #if AXIS_HAS_STALLGUARD(X2)
1217
             tmc_disable_stallguard(stepperX2, enable_stealth.x2);
1217
             tmc_disable_stallguard(stepperX2, enable_stealth.x2);
1218
           #endif
1218
           #endif
1219
-          #if CORE_IS_XY && Y_SENSORLESS
1219
+          #if EITHER(CORE_IS_XY, MARKFORGED_XY) && Y_SENSORLESS
1220
             tmc_disable_stallguard(stepperY, enable_stealth.y);
1220
             tmc_disable_stallguard(stepperY, enable_stealth.y);
1221
           #elif CORE_IS_XZ && Z_SENSORLESS
1221
           #elif CORE_IS_XZ && Z_SENSORLESS
1222
             tmc_disable_stallguard(stepperZ, enable_stealth.z);
1222
             tmc_disable_stallguard(stepperZ, enable_stealth.z);
1229
           #if AXIS_HAS_STALLGUARD(Y2)
1229
           #if AXIS_HAS_STALLGUARD(Y2)
1230
             tmc_disable_stallguard(stepperY2, enable_stealth.y2);
1230
             tmc_disable_stallguard(stepperY2, enable_stealth.y2);
1231
           #endif
1231
           #endif
1232
-          #if CORE_IS_XY && X_SENSORLESS
1232
+          #if EITHER(CORE_IS_XY, MARKFORGED_XY) && X_SENSORLESS
1233
             tmc_disable_stallguard(stepperX, enable_stealth.x);
1233
             tmc_disable_stallguard(stepperX, enable_stealth.x);
1234
           #elif CORE_IS_YZ && Z_SENSORLESS
1234
           #elif CORE_IS_YZ && Z_SENSORLESS
1235
             tmc_disable_stallguard(stepperZ, enable_stealth.z);
1235
             tmc_disable_stallguard(stepperZ, enable_stealth.z);
1789
       do_homing_move(axis, adjDistance, get_homing_bump_feedrate(axis));
1789
       do_homing_move(axis, adjDistance, get_homing_bump_feedrate(axis));
1790
     }
1790
     }
1791
 
1791
 
1792
-  #else // CARTESIAN / CORE
1792
+  #else // CARTESIAN / CORE / MARKFORGED_XY
1793
 
1793
 
1794
     set_axis_is_at_home(axis);
1794
     set_axis_is_at_home(axis);
1795
     sync_plan_position();
1795
     sync_plan_position();
1818
 
1818
 
1819
       #if ENABLED(SENSORLESS_HOMING)
1819
       #if ENABLED(SENSORLESS_HOMING)
1820
         planner.synchronize();
1820
         planner.synchronize();
1821
-        if (TERN0(IS_CORE, axis != NORMAL_AXIS))
1822
-          safe_delay(200);  // Short delay to allow belts to spring back
1821
+        if (false
1822
+          #if EITHER(IS_CORE, MARKFORGED_XY)
1823
+            || axis != NORMAL_AXIS
1824
+          #endif
1825
+        ) safe_delay(200);  // Short delay to allow belts to spring back
1823
       #endif
1826
       #endif
1824
     }
1827
     }
1825
   #endif
1828
   #endif

+ 43
- 5
Marlin/src/module/planner.cpp View File

1614
 float Planner::get_axis_position_mm(const AxisEnum axis) {
1614
 float Planner::get_axis_position_mm(const AxisEnum axis) {
1615
   float axis_steps;
1615
   float axis_steps;
1616
   #if IS_CORE
1616
   #if IS_CORE
1617
+
1617
     // Requesting one of the "core" axes?
1618
     // Requesting one of the "core" axes?
1618
     if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
1619
     if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
1619
 
1620
 
1631
     }
1632
     }
1632
     else
1633
     else
1633
       axis_steps = stepper.position(axis);
1634
       axis_steps = stepper.position(axis);
1635
+
1636
+  #elif ENABLED(MARKFORGED_XY)
1637
+
1638
+    // Requesting one of the joined axes?
1639
+    if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) {
1640
+      // Protect the access to the position.
1641
+      const bool was_enabled = stepper.suspend();
1642
+
1643
+      const int32_t p1 = stepper.position(CORE_AXIS_1),
1644
+                    p2 = stepper.position(CORE_AXIS_2);
1645
+
1646
+      if (was_enabled) stepper.wake_up();
1647
+
1648
+      axis_steps = ((axis == CORE_AXIS_1) ? p1 - p2 : p2);
1649
+    }
1650
+    else
1651
+      axis_steps = stepper.position(axis);
1652
+
1634
   #else
1653
   #else
1654
+
1635
     axis_steps = stepper.position(axis);
1655
     axis_steps = stepper.position(axis);
1656
+
1636
   #endif
1657
   #endif
1658
+
1637
   return axis_steps * steps_to_mm[axis];
1659
   return axis_steps * steps_to_mm[axis];
1638
 }
1660
 }
1639
 
1661
 
1808
     if (dc < 0) SBI(dm, Z_HEAD);                // ...and Z
1830
     if (dc < 0) SBI(dm, Z_HEAD);                // ...and Z
1809
     if (db + dc < 0) SBI(dm, B_AXIS);           // Motor B direction
1831
     if (db + dc < 0) SBI(dm, B_AXIS);           // Motor B direction
1810
     if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
1832
     if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction
1833
+  #elif ENABLED(MARKFORGED_XY)
1834
+    if (da < 0) SBI(dm, X_HEAD);                // Save the real Extruder (head) direction in X Axis
1835
+    if (db < 0) SBI(dm, Y_HEAD);                // ...and Y
1836
+    if (dc < 0) SBI(dm, Z_AXIS);
1837
+    if (da + db < 0) SBI(dm, A_AXIS);           // Motor A direction
1838
+    if (db < 0) SBI(dm, B_AXIS);                // Motor B direction
1811
   #else
1839
   #else
1812
     if (da < 0) SBI(dm, X_AXIS);
1840
     if (da < 0) SBI(dm, X_AXIS);
1813
     if (db < 0) SBI(dm, Y_AXIS);
1841
     if (db < 0) SBI(dm, Y_AXIS);
1843
     block->steps.set(ABS(da + dc), ABS(db), ABS(da - dc));
1871
     block->steps.set(ABS(da + dc), ABS(db), ABS(da - dc));
1844
   #elif CORE_IS_YZ
1872
   #elif CORE_IS_YZ
1845
     block->steps.set(ABS(da), ABS(db + dc), ABS(db - dc));
1873
     block->steps.set(ABS(da), ABS(db + dc), ABS(db - dc));
1874
+  #elif ENABLED(MARKFORGED_XY)
1875
+    block->steps.set(ABS(da + db), ABS(db), ABS(dc));
1846
   #elif IS_SCARA
1876
   #elif IS_SCARA
1847
     block->steps.set(ABS(da), ABS(db), ABS(dc));
1877
     block->steps.set(ABS(da), ABS(db), ABS(dc));
1848
   #else
1878
   #else
1859
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
1889
    * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
1860
    */
1890
    */
1861
   struct DistanceMM : abce_float_t {
1891
   struct DistanceMM : abce_float_t {
1862
-    TERN_(IS_CORE, xyz_pos_t head);
1892
+    #if EITHER(IS_CORE, MARKFORGED_XY)
1893
+      xyz_pos_t head;
1894
+    #endif
1863
   } steps_dist_mm;
1895
   } steps_dist_mm;
1864
   #if IS_CORE
1896
   #if IS_CORE
1865
     #if CORE_IS_XY
1897
     #if CORE_IS_XY
1881
       steps_dist_mm.b      = (db + dc) * steps_to_mm[B_AXIS];
1913
       steps_dist_mm.b      = (db + dc) * steps_to_mm[B_AXIS];
1882
       steps_dist_mm.c      = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
1914
       steps_dist_mm.c      = CORESIGN(db - dc) * steps_to_mm[C_AXIS];
1883
     #endif
1915
     #endif
1916
+  #elif ENABLED(MARKFORGED_XY)
1917
+    steps_dist_mm.head.x = da * steps_to_mm[A_AXIS];
1918
+    steps_dist_mm.head.y = db * steps_to_mm[B_AXIS];
1919
+    steps_dist_mm.z      = dc * steps_to_mm[Z_AXIS];
1920
+    steps_dist_mm.a      = (da - db) * steps_to_mm[A_AXIS];
1921
+    steps_dist_mm.b      = db * steps_to_mm[B_AXIS];
1884
   #else
1922
   #else
1885
     steps_dist_mm.a = da * steps_to_mm[A_AXIS];
1923
     steps_dist_mm.a = da * steps_to_mm[A_AXIS];
1886
     steps_dist_mm.b = db * steps_to_mm[B_AXIS];
1924
     steps_dist_mm.b = db * steps_to_mm[B_AXIS];
1907
       block->millimeters = millimeters;
1945
       block->millimeters = millimeters;
1908
     else
1946
     else
1909
       block->millimeters = SQRT(
1947
       block->millimeters = SQRT(
1910
-        #if CORE_IS_XY
1948
+        #if EITHER(CORE_IS_XY, MARKFORGED_XY)
1911
           sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z)
1949
           sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z)
1912
         #elif CORE_IS_XZ
1950
         #elif CORE_IS_XZ
1913
           sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z)
1951
           sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z)
1964
   #endif
2002
   #endif
1965
 
2003
 
1966
   // Enable active axes
2004
   // Enable active axes
1967
-  #if CORE_IS_XY
2005
+  #if EITHER(CORE_IS_XY, MARKFORGED_XY)
1968
     if (block->steps.a || block->steps.b) {
2006
     if (block->steps.a || block->steps.b) {
1969
       ENABLE_AXIS_X();
2007
       ENABLE_AXIS_X();
1970
       ENABLE_AXIS_Y();
2008
       ENABLE_AXIS_Y();
2325
      * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y].
2363
      * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y].
2326
      * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters".
2364
      * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters".
2327
      * => normalize the complete junction vector.
2365
      * => normalize the complete junction vector.
2328
-     * Elsewise, when needed JD factors in the E component
2366
+     * Elsewise, when needed JD will factor-in the E component
2329
      */
2367
      */
2330
-    if (ENABLED(IS_CORE) || esteps > 0)
2368
+    if (EITHER(IS_CORE, MARKFORGED_XY) || esteps > 0)
2331
       normalize_junction_vector(unit_vec);  // Normalize with XYZE components
2369
       normalize_junction_vector(unit_vec);  // Normalize with XYZE components
2332
     else
2370
     else
2333
       unit_vec *= inverse_millimeters;      // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2))
2371
       unit_vec *= inverse_millimeters;      // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2))

+ 10
- 2
Marlin/src/module/stepper.cpp View File

2041
           #define X_CMP(A,B) ((A)!=(B))
2041
           #define X_CMP(A,B) ((A)!=(B))
2042
         #endif
2042
         #endif
2043
         #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && X_CMP(D_(1),D_(2))) )
2043
         #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && X_CMP(D_(1),D_(2))) )
2044
+      #elif ENABLED(MARKFORGED_XY)
2045
+        #define X_MOVE_TEST (current_block->steps.a != current_block->steps.b)
2044
       #else
2046
       #else
2045
         #define X_MOVE_TEST !!current_block->steps.a
2047
         #define X_MOVE_TEST !!current_block->steps.a
2046
       #endif
2048
       #endif
2614
   #elif CORE_IS_YZ
2616
   #elif CORE_IS_YZ
2615
     // coreyz planning
2617
     // coreyz planning
2616
     count_position.set(a, b + c, CORESIGN(b - c));
2618
     count_position.set(a, b + c, CORESIGN(b - c));
2619
+  #elif ENABLED(MARKFORGED_XY)
2620
+    count_position.set(a - b, b, c);
2617
   #else
2621
   #else
2618
     // default non-h-bot planning
2622
     // default non-h-bot planning
2619
     count_position.set(a, b, c);
2623
     count_position.set(a, b, c);
2680
         ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
2684
         ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
2681
         : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
2685
         : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
2682
       ) * double(0.5)
2686
       ) * double(0.5)
2687
+    #elif ENABLED(MARKFORGED_XY)
2688
+      axis == CORE_AXIS_1
2689
+        ? count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2]
2690
+        : count_position[CORE_AXIS_2]
2683
     #else // !IS_CORE
2691
     #else // !IS_CORE
2684
       count_position[axis]
2692
       count_position[axis]
2685
     #endif
2693
     #endif
2709
 }
2717
 }
2710
 
2718
 
2711
 void Stepper::report_a_position(const xyz_long_t &pos) {
2719
 void Stepper::report_a_position(const xyz_long_t &pos) {
2712
-  #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
2720
+  #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, DELTA, IS_SCARA)
2713
     SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
2721
     SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
2714
   #else
2722
   #else
2715
     SERIAL_ECHOPAIR_P(PSTR(STR_COUNT_X), pos.x, SP_Y_LBL, pos.y);
2723
     SERIAL_ECHOPAIR_P(PSTR(STR_COUNT_X), pos.x, SP_Y_LBL, pos.y);
2716
   #endif
2724
   #endif
2717
-  #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
2725
+  #if ANY(CORE_IS_XZ, CORE_IS_YZ, DELTA)
2718
     SERIAL_ECHOLNPAIR(" C:", pos.z);
2726
     SERIAL_ECHOLNPAIR(" C:", pos.z);
2719
   #else
2727
   #else
2720
     SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z);
2728
     SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z);

Loading…
Cancel
Save