From 59eb1693cb3ccf8d76098ddd235ccc35f1d7c670 Mon Sep 17 00:00:00 2001 From: snacj <0xsnacj@proton.me> Date: Mon, 11 Aug 2025 14:40:28 +0200 Subject: [PATCH] Added Control Functions --- .../buffer1/buffer_lift_controller.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/server/src/machines/buffer1/buffer_lift_controller.rs b/server/src/machines/buffer1/buffer_lift_controller.rs index 33d56d49..fef92dff 100644 --- a/server/src/machines/buffer1/buffer_lift_controller.rs +++ b/server/src/machines/buffer1/buffer_lift_controller.rs @@ -121,7 +121,7 @@ impl BufferLiftController { limit_top, limit_bottom: Length::new::(0.0), step_size: Length::new::(1.75), // Default padding - padding: Length::new::(0.9), // Default padding + padding: Length::new::(0.9), // Default padding did_change_state: false, stepper_driver: driver, fullstep_converter: LinearStepConverter::from_circumference( @@ -252,6 +252,14 @@ impl BufferLiftController { /// State management impl BufferLiftController { + pub fn goto_limit_top(&mut self) { + self.state = State::GoingUp + } + + pub fn goto_limit_bottom(&mut self) { + self.state = State::GoingDown + } + pub fn goto_home(&mut self) { self.state = State::Homing(HomingState::Initialize); } @@ -260,6 +268,16 @@ impl BufferLiftController { self.state = State::Buffering(BufferingState::GoingUp); } + pub fn is_going_up(&self) -> bool { + // [`State::GoingUp`] + matches!(self.state, State::GoingUp) + } + + pub fn is_going_down(&self) -> bool { + // [`State::GoingDown`] + matches!(self.state, State::GoingDown) + } + pub fn is_homed(&self) -> bool { // if not [`State::NotHomed`], then it is homed !matches!(self.state, State::NotHomed)