From 6fa0a1b12f886f77a3dca1a9442e8b7601d10f60 Mon Sep 17 00:00:00 2001 From: Mara Date: Sat, 8 Nov 2025 15:26:14 +0100 Subject: [PATCH 1/2] luuuuuuuul --- flight-computer/src/state_machine.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/flight-computer/src/state_machine.rs b/flight-computer/src/state_machine.rs index 0cba44a..b8d6b54 100644 --- a/flight-computer/src/state_machine.rs +++ b/flight-computer/src/state_machine.rs @@ -10,6 +10,8 @@ pub enum State { Thrusting { last_velocity: f32 }, Coasting, Descend, + MainDescend, + Touchdown, Shutdown, } @@ -21,7 +23,7 @@ impl State { avionics: &mut MessageSender, ) { match self { - State::Idle | State::Shutdown | State::Descend => {} + State::Idle | State::Shutdown | State::Touchdown => {} State::Thrusting { last_velocity } => { if inputs.velocity.down.abs() < *last_velocity { println!("Starting to decelerate"); @@ -36,6 +38,17 @@ impl State { *self = State::Descend; } } + State::Descend => { + if inputs.location.altitude < 3000.0 { + let _ = avionics.send(&AvionicsCommandMessage::DeployMain).await; + *self = State::MainDescend; + } + } + State::MainDescend => { + if inputs.location.altitude < 0.1 && inputs.velocity.down.abs() < 0.1 { + *self = State::Touchdown; + } + } } } From dbbe66dd772f68d9792c6e9c1cece8dc2323035b Mon Sep 17 00:00:00 2001 From: Mara Date: Sat, 8 Nov 2025 15:51:28 +0100 Subject: [PATCH 2/2] Added Comment to test our greatness --- flight-computer/src/state_machine.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/flight-computer/src/state_machine.rs b/flight-computer/src/state_machine.rs index b8d6b54..0d05bfb 100644 --- a/flight-computer/src/state_machine.rs +++ b/flight-computer/src/state_machine.rs @@ -40,6 +40,7 @@ impl State { } State::Descend => { if inputs.location.altitude < 3000.0 { + println!("We are so great"); let _ = avionics.send(&AvionicsCommandMessage::DeployMain).await; *self = State::MainDescend; }