From 3fb6bbdd6aa9bc8d20668b99790645c53f846b9b Mon Sep 17 00:00:00 2001 From: Cameron Goddard Date: Wed, 4 Dec 2024 21:25:18 -0500 Subject: [PATCH] update blims --- src/blims/blims.cpp | 10 ++++---- src/constants.hpp | 49 ++++++++++++++++++++-------------------- src/core/flight_mode.cpp | 9 ++++---- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/blims/blims.cpp b/src/blims/blims.cpp index 3bb4a72..66c7f6a 100644 --- a/src/blims/blims.cpp +++ b/src/blims/blims.cpp @@ -72,9 +72,9 @@ void BLIMS::execute() { } printf("TEST 5\n"); // check altitude - if (state::alt::altitude < constants::brake_alt) { - set_motor_position(0.5); - state::blims::below_brake_alt = true; - state::flight::events.emplace_back(Event::below_brake_alt); // logs the event to SD - } + // if (state::alt::altitude < constants::brake_alt) { + // set_motor_position(0.5); + // state::blims::below_brake_alt = true; + // state::flight::events.emplace_back(Event::below_brake_alt); // logs the event to SD + // } } diff --git a/src/constants.hpp b/src/constants.hpp index 9b84507..21e81fd 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -10,40 +10,39 @@ #endif enum class Event : uint8_t { - key_armed = 0, - alt_armed = 1, + alt_armed = 0, - alt_init_fail = 2, - alt_read_fail = 3, - alt_turn_off = 4, + alt_init_fail = 1, + alt_read_fail = 2, + alt_turn_off = 3, - gps_init_fail = 5, - gps_read_fail = 6, - gps_turn_off = 7, + gps_init_fail = 4, + gps_read_fail = 5, + gps_turn_off = 6, - imu_init_fail = 8, - imu_read_fail = 9, - imu_turn_off = 10, + imu_init_fail = 7, + imu_read_fail = 8, + imu_turn_off = 9, - accel_init_fail = 11, - accel_read_fail = 12, - accel_turn_off = 13, + accel_init_fail = 10, + accel_read_fail = 11, + accel_turn_off = 12, - therm_init_fail = 14, - therm_read_fail = 15, - therm_turn_off = 16, + therm_init_fail = 13, + therm_read_fail = 14, + therm_turn_off = 15, - sd_init_fail = 17, - sd_write_fail = 18, + sd_init_fail = 16, + sd_write_fail = 17, - rfm_init_fail = 19, - rfm_tx_fail = 20, + rfm_init_fail = 18, + rfm_tx_fail = 19, - main_deploy_wait_end = 21, - main_log_shutoff = 22, + main_deploy_wait_end = 20, + main_log_shutoff = 21, - below_brake_alt = 23, - blims_threshold_reached = 24 + below_brake_alt = 22, + blims_threshold_reached = 23 }; diff --git a/src/core/flight_mode.cpp b/src/core/flight_mode.cpp index 2f691ac..61ce5fa 100644 --- a/src/core/flight_mode.cpp +++ b/src/core/flight_mode.cpp @@ -1,11 +1,11 @@ #include "flight_mode.hpp" -// #include "../../sim/sim_data.hpp" +#include "../../sim/sim_data.hpp" #include "../constants.hpp" #include "../pins.hpp" #include "hardware/gpio.h" #include "modules.hpp" #include "state.hpp" -// SimData sim_data; +SimData sim_data; void FlightMode::execute() { if (!state::alt::status == OFF) { @@ -13,7 +13,7 @@ void FlightMode::execute() { ret = modules::altimeter.read_pressure(&state::alt::pressure); check_sensor(ALT); } - // state::alt::altitude = sim_data.get_alt(); + state::alt::altitude = sim_data.get_alt(); if (!state::gps::status == OFF) { ret = modules::gps.read_data(&state::gps::data); @@ -55,7 +55,7 @@ void FlightMode::execute() { ); check_sensor(ACCEL); } - // state::accel::accel_z = sim_data.get_accel(); + state::accel::accel_z = sim_data.get_accel(); if (!state::therm::status == OFF) { ret = modules::therm.read_temperature(&state::therm::temp); @@ -171,7 +171,6 @@ void StartupMode::execute() { if (gpio_get(ARMED_IN)) { state::flight::key_armed = true; gpio_put(ARMED_OUT, 1); - state::flight::events.emplace_back(Event::key_armed); } // Attempt to initialize all modules