Skip to content

Commit

Permalink
fix move_to
Browse files Browse the repository at this point in the history
  • Loading branch information
hacknus committed Oct 13, 2023
1 parent 266b124 commit 017fbbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ impl<SPI, CS, EN, E> Tmc5160<SPI, CS, EN>
}

/// move to a specific location
pub fn move_to(&mut self, target_signed: i32) -> Result<DataPacket, Error<E>> {
pub fn move_to(&mut self, target: f32) -> Result<DataPacket, Error<E>> {
self.enable()?;
let target = target_signed * self._step_count as i32;
let target = (target * self._step_count) as i32;
let mut val = target.to_be_bytes();
let packet = self.write_register(Registers::XTARGET, &mut val)?;
self.status = packet.status;
Expand Down

0 comments on commit 017fbbd

Please sign in to comment.