Browse Source

CORE support for st_set_position & plan_set_position

Scott Lahteine 8 years ago
parent
commit
3e5312f116
1 changed files with 28 additions and 3 deletions
  1. 28
    3
      Marlin/stepper.cpp

+ 28
- 3
Marlin/stepper.cpp View File

@@ -1084,11 +1084,36 @@ void st_init() {
1084 1084
  */
1085 1085
 void st_synchronize() { while (blocks_queued()) idle(); }
1086 1086
 
1087
+/**
1088
+ * Set the stepper positions directly in steps
1089
+ *
1090
+ * The input is based on the typical per-axis XYZ steps.
1091
+ * For CORE machines XYZ needs to be translated to ABC.
1092
+ *
1093
+ * This allows st_get_axis_position_mm to correctly
1094
+ * derive the current XYZ position later on.
1095
+ */
1087 1096
 void st_set_position(const long& x, const long& y, const long& z, const long& e) {
1088 1097
   CRITICAL_SECTION_START;
1089
-  count_position[X_AXIS] = x;
1090
-  count_position[Y_AXIS] = y;
1091
-  count_position[Z_AXIS] = z;
1098
+
1099
+  #if ENABLED(COREXY)
1100
+    // corexy positioning
1101
+    // these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
1102
+    count_position[A_AXIS] = x + y;
1103
+    count_position[B_AXIS] = x - y;
1104
+    count_position[Z_AXIS] = z;
1105
+  #elif ENABLED(COREXZ)
1106
+    // corexz planning
1107
+    count_position[A_AXIS] = x + z;
1108
+    count_position[Y_AXIS] = y;
1109
+    count_position[C_AXIS] = x - z;
1110
+  #else
1111
+    // default non-h-bot planning
1112
+    count_position[X_AXIS] = x;
1113
+    count_position[Y_AXIS] = y;
1114
+    count_position[Z_AXIS] = z;
1115
+  #endif
1116
+
1092 1117
   count_position[E_AXIS] = e;
1093 1118
   CRITICAL_SECTION_END;
1094 1119
 }

Loading…
Cancel
Save