Scott Lahteine 8 年前
父节点
当前提交
614febaaf3
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8
    7
      Marlin/planner.cpp

+ 8
- 7
Marlin/planner.cpp 查看文件

@@ -742,7 +742,7 @@ float junction_deviation = 0.1;
742 742
   }
743 743
   float inverse_millimeters = 1.0 / block->millimeters;  // Inverse millimeters to remove multiple divides
744 744
 
745
-  // Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
745
+  // Calculate moves/second for this move. No divide by zero due to previous checks.
746 746
   float inverse_second = feed_rate * inverse_millimeters;
747 747
 
748 748
   int moves_queued = movesplanned();
@@ -853,7 +853,7 @@ float junction_deviation = 0.1;
853 853
 
854 854
   // Compute and limit the acceleration rate for the trapezoid generator.
855 855
   float steps_per_mm = block->step_event_count / block->millimeters;
856
-  long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS];
856
+  unsigned long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS];
857 857
   if (bsx == 0 && bsy == 0 && bsz == 0) {
858 858
     block->acceleration_st = ceil(retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
859 859
   }
@@ -868,11 +868,12 @@ float junction_deviation = 0.1;
868 868
                 xsteps = axis_steps_per_sqr_second[X_AXIS],
869 869
                 ysteps = axis_steps_per_sqr_second[Y_AXIS],
870 870
                 zsteps = axis_steps_per_sqr_second[Z_AXIS],
871
-                esteps = axis_steps_per_sqr_second[E_AXIS];
872
-  if ((float)acc_st * bsx / block->step_event_count > xsteps) acc_st = xsteps;
873
-  if ((float)acc_st * bsy / block->step_event_count > ysteps) acc_st = ysteps;
874
-  if ((float)acc_st * bsz / block->step_event_count > zsteps) acc_st = zsteps;
875
-  if ((float)acc_st * bse / block->step_event_count > esteps) acc_st = esteps;
871
+                esteps = axis_steps_per_sqr_second[E_AXIS],
872
+                allsteps = block->step_event_count;
873
+  if (xsteps < (acc_st * bsx) / allsteps) acc_st = (xsteps * allsteps) / bsx;
874
+  if (ysteps < (acc_st * bsy) / allsteps) acc_st = (ysteps * allsteps) / bsy;
875
+  if (zsteps < (acc_st * bsz) / allsteps) acc_st = (zsteps * allsteps) / bsz;
876
+  if (esteps < (acc_st * bse) / allsteps) acc_st = (esteps * allsteps) / bse;
876 877
 
877 878
   block->acceleration_st = acc_st;
878 879
   block->acceleration = acc_st / steps_per_mm;

正在加载...
取消
保存