Просмотр исходного кода

Improve kinematic optimization options

Scott Lahteine 8 лет назад
Родитель
Сommit
85e607153b
1 измененных файлов: 20 добавлений и 15 удалений
  1. 20
    15
      Marlin/Marlin_main.cpp

+ 20
- 15
Marlin/Marlin_main.cpp Просмотреть файл

@@ -7843,15 +7843,19 @@ void ok_to_send() {
7843 7843
       )                                      \
7844 7844
     )
7845 7845
 
7846
+  #define DELTA_RAW_IK() do {   \
7847
+    delta[A_AXIS] = DELTA_Z(1); \
7848
+    delta[B_AXIS] = DELTA_Z(2); \
7849
+    delta[C_AXIS] = DELTA_Z(3); \
7850
+  } while(0)
7851
+
7846 7852
   #define DELTA_LOGICAL_IK() do {      \
7847 7853
     const float raw[XYZ] = {           \
7848 7854
       RAW_X_POSITION(logical[X_AXIS]), \
7849 7855
       RAW_Y_POSITION(logical[Y_AXIS]), \
7850 7856
       RAW_Z_POSITION(logical[Z_AXIS])  \
7851 7857
     };                                 \
7852
-    delta[A_AXIS] = DELTA_Z(1);        \
7853
-    delta[B_AXIS] = DELTA_Z(2);        \
7854
-    delta[C_AXIS] = DELTA_Z(3);        \
7858
+    DELTA_RAW_IK();                    \
7855 7859
   } while(0)
7856 7860
 
7857 7861
   #define DELTA_DEBUG() do { \
@@ -8138,15 +8142,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8138 8142
 
8139 8143
     // Send all the segments to the planner
8140 8144
 
8141
-    #if ENABLED(DELTA) && ENABLED(USE_RAW_KINEMATICS)
8142
-
8143
-      #define DELTA_E raw[E_AXIS]
8144
-      #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) raw[i] += ADDEND;
8145
-      #define DELTA_IK() do {       \
8146
-        delta[A_AXIS] = DELTA_Z(1); \
8147
-        delta[B_AXIS] = DELTA_Z(2); \
8148
-        delta[C_AXIS] = DELTA_Z(3); \
8149
-      } while(0)
8145
+    #if ENABLED(USE_RAW_KINEMATICS)
8150 8146
 
8151 8147
       // Get the raw current position as starting point
8152 8148
       float raw[ABC] = {
@@ -8155,8 +8151,20 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8155 8151
         RAW_CURRENT_POSITION(Z_AXIS)
8156 8152
       };
8157 8153
 
8154
+      #define DELTA_E raw[E_AXIS]
8155
+      #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) raw[i] += ADDEND;
8156
+
8157
+      #if ENABLED(DELTA)
8158
+        #define DELTA_IK() DELTA_RAW_IK()
8159
+      #else
8160
+        #define DELTA_IK() inverse_kinematics(raw)
8161
+      #endif
8162
+
8158 8163
     #else
8159 8164
 
8165
+      // Get the logical current position as starting point
8166
+      LOOP_XYZE(i) logical[i] = current_position[i];
8167
+
8160 8168
       #define DELTA_E logical[E_AXIS]
8161 8169
       #define DELTA_NEXT(ADDEND) LOOP_XYZE(i) logical[i] += ADDEND;
8162 8170
 
@@ -8166,9 +8174,6 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
8166 8174
         #define DELTA_IK() inverse_kinematics(logical)
8167 8175
       #endif
8168 8176
 
8169
-      // Get the logical current position as starting point
8170
-      LOOP_XYZE(i) logical[i] = current_position[i];
8171
-
8172 8177
     #endif
8173 8178
 
8174 8179
     #if ENABLED(USE_DELTA_IK_INTERPOLATION)

Загрузка…
Отмена
Сохранить