Browse Source

Account for DELTA in Planner::refresh_positioning

Scott Lahteine 8 years ago
parent
commit
844a4e799e
3 changed files with 9 additions and 3 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 2
    2
      Marlin/Marlin_main.cpp
  3. 6
    1
      Marlin/planner.cpp

+ 1
- 0
Marlin/Marlin.h View File

@@ -314,6 +314,7 @@ float code_value_temp_diff();
314 314
     void adjust_delta(float cartesian[3]);
315 315
   #endif
316 316
 #elif ENABLED(SCARA)
317
+  extern float delta[3];
317 318
   extern float axis_scaling[3];  // Build size scaling
318 319
   void inverse_kinematics(const float cartesian[3]);
319 320
   void forward_kinematics_SCARA(float f_scara[3]);

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -456,7 +456,7 @@ static uint8_t target_extruder;
456 456
   #define TOWER_2 Y_AXIS
457 457
   #define TOWER_3 Z_AXIS
458 458
 
459
-  float delta[3] = { 0 };
459
+  float delta[3];
460 460
   float cartesian_position[3] = { 0 };
461 461
   #define SIN_60 0.8660254037844386
462 462
   #define COS_60 0.5
@@ -489,7 +489,7 @@ static uint8_t target_extruder;
489 489
 
490 490
 #if ENABLED(SCARA)
491 491
   float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND;
492
-  static float delta[3] = { 0 };
492
+  float delta[3];
493 493
   float axis_scaling[3] = { 1, 1, 1 };    // Build size scaling, default to 1
494 494
 #endif
495 495
 

+ 6
- 1
Marlin/planner.cpp View File

@@ -1183,7 +1183,12 @@ void Planner::reset_acceleration_rates() {
1183 1183
 // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
1184 1184
 void Planner::refresh_positioning() {
1185 1185
   LOOP_XYZE(i) planner.steps_to_mm[i] = 1.0 / planner.axis_steps_per_mm[i];
1186
-  set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1186
+  #if ENABLED(DELTA) || ENABLED(SCARA)
1187
+    inverse_kinematics(current_position);
1188
+    set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1189
+  #else
1190
+    set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1191
+  #endif
1187 1192
   reset_acceleration_rates();
1188 1193
 }
1189 1194
 

Loading…
Cancel
Save