Skip to content

Commit

Permalink
Fix tracking of e position through arcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dalegaard committed Feb 7, 2023
1 parent 2c7b578 commit 7bd1080
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/arcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ impl ArcState {
direction,
args.mm_per_arc_segment,
);
let e_base = toolhead_state.position.w;
let e_per_move = args.e.map(|e| (e - e_base) / (segments as f64));
let mut e_base = toolhead_state.position.w;
let e_per_move = args.e.map_or(0.0, |e| (e - e_base) / (segments as f64));

toolhead_state.set_speed(args.velocity);

let old_pos_mode = toolhead_state.position_modes;
toolhead_state.position_modes = [PositionMode::Absolute; 4];
for (i, segment) in arc.enumerate() {
for segment in arc {
e_base += e_per_move;
let coord = [
Some(segment.x),
Some(segment.y),
Some(segment.z),
e_per_move.map(|e| e_base + (i as f64) * e),
Some(e_base),
];
let mut pm = toolhead_state.perform_move(coord);
pm.kind = move_kind;
Expand Down

0 comments on commit 7bd1080

Please sign in to comment.