Skip to content

Commit

Permalink
[FC] Workaround for adaptive power level toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
stojadin2701 committed Oct 8, 2023
1 parent f5e2651 commit c98f52e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flight_computer/src/tasks/task_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum state_e {
#define INDEX_OP 0
#define INDEX_LEN 1
#define TELE_MAX_POWER 30
static constexpr uint32_t kDefaultPaGain = 34;

void Telemetry::PackTxMessage(uint32_t ts, gnss_data_t* gnss, packed_tx_msg_t* tx_payload,
estimation_output_t estimation_data) const noexcept {
Expand Down Expand Up @@ -294,9 +295,15 @@ void Telemetry::ParseRxMessage(packed_rx_msg_t* rx_payload) noexcept {
if (global_cats_config.telemetry_settings.adaptive_power == ON) {
if (fsm_updated && (m_fsm_enum == THRUSTING)) {
SendSettings(CMD_POWER_LEVEL, TELE_MAX_POWER);
// Send PA gain to update power level; 34 is already the default value on telemetry chip
// NOTE: This line has to stay here forever as telemetry code can't be updated for all boards
SendSettings(CMD_PA_GAIN, kDefaultPaGain);
}
if (fsm_updated && (m_fsm_enum == TOUCHDOWN)) {
SendSettings(CMD_POWER_LEVEL, global_cats_config.telemetry_settings.power_level);
// Send PA gain to update power level; 34 is already the default value on telemetry chip
// NOTE: This line has to stay here forever as telemetry code can't be updated for all boards
SendSettings(CMD_PA_GAIN, kDefaultPaGain);
}
}

Expand Down

0 comments on commit c98f52e

Please sign in to comment.