summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-07-12 14:35:48 +0200
committerkliment <kliment.yanev@gmail.com>2011-07-12 14:35:48 +0200
commit33edcb56e2a6e85943f261624d6f08a81889a981 (patch)
tree3b457e1d341a939464b0e6b0cd52ab06d240bf59
parent1c8f09f7c78ffde66fee9b9f0e61fd0788bb8895 (diff)
parent331653b519f052958cc553c6b9d0a97ee62a0658 (diff)
Merge branch 'master' into experimental
-rw-r--r--Sprinter/Sprinter.pde6
1 files changed, 5 insertions, 1 deletions
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 230bba0..8bb68d7 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -1112,7 +1112,11 @@ inline void linear_move(unsigned long axis_steps_remaining[]) // make linear mov
}
for(int i = 0; i < NUM_AXIS; i++)
if(axis_steps_remaining[i] >0) {
- new_axis_max_intervals[i] = slowest_start_axis_max_interval * axis_steps_remaining[slowest_start_axis] / axis_steps_remaining[i];
+ // multiplying slowest_start_axis_max_interval by axis_steps_remaining[slowest_start_axis]
+ // could lead to overflows when we have long distance moves (say, 390625*390625 > sizeof(unsigned long))
+ float steps_remaining_ratio = axis_steps_remaining[slowest_start_axis] / axis_steps_remaining[i];
+ new_axis_max_intervals[i] = slowest_start_axis_max_interval * steps_remaining_ratio;
+
if(i == primary_axis) {
max_interval = new_axis_max_intervals[i];
min_speed_steps_per_second = 100000000 / max_interval;