Improve docs

This commit is contained in:
Frederik Menke 2024-01-01 01:31:27 +01:00
parent eaab62ab88
commit a65f523636

View file

@ -180,11 +180,23 @@ impl Printer {
.map_err(|_| make_err()) .map_err(|_| make_err())
} }
/// Switch the printer to absolute movement mode.
///
/// This is generally necessary before sending consecutive `self.move_absolute()` commands.
/// Otherwise, the motion planner on the printer will stop the printer between all movements
/// as `self.move_absolute()` will call `use_absolute_movements` and `use_relative_movements`
/// itself. (See its documentation)
pub async fn use_absolute_movements(&mut self) -> Result<(), PrinterError> { pub async fn use_absolute_movements(&mut self) -> Result<(), PrinterError> {
self.state.movement_mode = MovementMode::AbsoluteMovements; self.state.movement_mode = MovementMode::AbsoluteMovements;
self.send_gcode(G90Command).await self.send_gcode(G90Command).await
} }
/// Switch the printer to relative movement mode.
///
/// This is generally necessary before sending consecutive `self.move_relative()` commands.
/// Otherwise, the motion planner on the printer will stop the printer between all movements
/// as `self.move_relative()` will call `use_absolute_movements` and `use_relative_movements`
/// itself. (See its documentation)
pub async fn use_relative_movements(&mut self) -> Result<(), PrinterError> { pub async fn use_relative_movements(&mut self) -> Result<(), PrinterError> {
self.state.movement_mode = MovementMode::RelativeMovements; self.state.movement_mode = MovementMode::RelativeMovements;
self.send_gcode(G91Command).await self.send_gcode(G91Command).await
@ -194,7 +206,7 @@ impl Printer {
/// ///
/// # Arguments /// # Arguments
/// * `x, y, z` - Whether the axis should be homed. Axis that are set to `false` will not be /// * `x, y, z` - Whether the axis should be homed. Axis that are set to `false` will not be
/// homed. /// homed.,
pub async fn auto_home(&mut self, x: bool, y: bool, z: bool) -> Result<(), PrinterError> { pub async fn auto_home(&mut self, x: bool, y: bool, z: bool) -> Result<(), PrinterError> {
let res = self.send_gcode(G28Command::new(x, y, z)).await?; let res = self.send_gcode(G28Command::new(x, y, z)).await?;
self.state.position = PrinterPosition { self.state.position = PrinterPosition {