Skip to content

Commit 7708f1d

Browse files
authored
Merge pull request #170 from ISSUIUC/feature/landing-power-save
Add vtx_off after landing lockout expires
2 parents e886eb5 + 2bd261a commit 7708f1d

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

MIDAS/src/finite-state-machines/fsm.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ FSMState FSM::tick_fsm(FSMState& state, StateEstimate state_estimate, CommandFla
298298
case FSMState::STATE_LANDED:
299299

300300
if((current_time - landed_time) > sustainer_landed_time_lockout) {
301+
302+
if(!landing_lockout_triggered) {
303+
landing_lockout_triggered = true;
304+
commands.FSM_should_power_save = true;
305+
}
301306

302307
// Check for any telem transitions
303308
// Force transtion to safe if requested + clear all transition flags.
@@ -513,6 +518,11 @@ FSMState FSM::tick_fsm(FSMState& state, StateEstimate state_estimate, CommandFla
513518

514519
if((current_time - landed_time) > booster_landed_time_lockout) {
515520

521+
if(!landing_lockout_triggered) {
522+
landing_lockout_triggered = true;
523+
commands.FSM_should_power_save = true;
524+
}
525+
516526
// Check for any telem transitions
517527
// Force transtion to safe if requested + clear all transition flags.
518528
if(commands.should_transition_safe) {

MIDAS/src/finite-state-machines/fsm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ class FSM {
4747
double landed_time;
4848
double first_separation_time;
4949
double pyro_test_entry_time;
50+
51+
bool landing_lockout_triggered = false;
5052
};

MIDAS/src/rocket_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct CommandFlags {
170170
bool should_fire_pyro_d = false; // CommandType::FIRE_PYRO_D
171171
// FSM Transition commands
172172
bool FSM_should_set_cam_feed_cam1 = false; // Triggered at launch (IDLE --> FIRST_BOOST)
173+
bool FSM_should_power_save = false; // Triggered after 60 seconds in LANDED state.
173174
bool FSM_should_swap_camera_feed = false; // Triggered COAST --> APOGEE
174175
};
175176
/**

MIDAS/src/systems.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ DECLARE_THREAD(fsm, RocketSystems* arg) {
194194
arg->b2b.camera.camera_on(BULKHEAD_CAMERA);
195195
}
196196

197+
if(arg->rocket_data.command_flags.FSM_should_power_save) {
198+
arg->rocket_data.command_flags.FSM_should_power_save = false;
199+
200+
arg->b2b.camera.vtx_off();
201+
}
202+
197203
if(arg->rocket_data.command_flags.FSM_should_swap_camera_feed) {
198204
// Swap camera feed to MUX 2 (recovery bay camera)
199205
arg->rocket_data.command_flags.FSM_should_swap_camera_feed = false;

0 commit comments

Comments
 (0)