Skip to content

Commit 7bd1080

Browse files
committed
Fix tracking of e position through arcs
1 parent 2c7b578 commit 7bd1080

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/src/arcs.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ impl ArcState {
3232
direction,
3333
args.mm_per_arc_segment,
3434
);
35-
let e_base = toolhead_state.position.w;
36-
let e_per_move = args.e.map(|e| (e - e_base) / (segments as f64));
35+
let mut e_base = toolhead_state.position.w;
36+
let e_per_move = args.e.map_or(0.0, |e| (e - e_base) / (segments as f64));
3737

3838
toolhead_state.set_speed(args.velocity);
3939

4040
let old_pos_mode = toolhead_state.position_modes;
4141
toolhead_state.position_modes = [PositionMode::Absolute; 4];
42-
for (i, segment) in arc.enumerate() {
42+
for segment in arc {
43+
e_base += e_per_move;
4344
let coord = [
4445
Some(segment.x),
4546
Some(segment.y),
4647
Some(segment.z),
47-
e_per_move.map(|e| e_base + (i as f64) * e),
48+
Some(e_base),
4849
];
4950
let mut pm = toolhead_state.perform_move(coord);
5051
pm.kind = move_kind;

0 commit comments

Comments
 (0)