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

Optimize calculation of block->millimeters for DELTA

Scott Lahteine 9 лет назад
Родитель
Сommit
b921f6b69d
1 измененных файлов: 16 добавлений и 4 удалений
  1. 16
    4
      Marlin/planner.cpp

+ 16
- 4
Marlin/planner.cpp Просмотреть файл

803
     #endif
803
     #endif
804
   #else
804
   #else
805
     float delta_mm[4];
805
     float delta_mm[4];
806
-    delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
807
-    delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
808
-    delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
806
+    #if ENABLED(DELTA)
807
+      // On delta all axes (should!) have the same steps-per-mm
808
+      // so calculate distance in steps first, then do one division
809
+      // at the end to get millimeters
810
+    #else
811
+      delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS];
812
+      delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS];
813
+      delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS];
814
+    #endif
809
   #endif
815
   #endif
810
   delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
816
   delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
811
 
817
 
820
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
826
         sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD])
821
       #elif ENABLED(COREYZ)
827
       #elif ENABLED(COREYZ)
822
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
828
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD])
829
+      #elif ENABLED(DELTA)
830
+        sq(dx) + sq(dy) + sq(dz)
823
       #else
831
       #else
824
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
832
         sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS])
825
       #endif
833
       #endif
826
-    );
834
+    )
835
+      #if ENABLED(DELTA)
836
+        / axis_steps_per_mm[X_AXIS]
837
+      #endif
838
+    ;
827
   }
839
   }
828
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides
840
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides
829
 
841
 

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