diff --git a/firmware/application/receiver_model.cpp b/firmware/application/receiver_model.cpp index 944ba4c1..4f4e4d1c 100644 --- a/firmware/application/receiver_model.cpp +++ b/firmware/application/receiver_model.cpp @@ -120,6 +120,7 @@ uint32_t ReceiverModel::baseband_oversampling() const { } void ReceiverModel::enable() { + enabled_ = true; radio::set_direction(rf::Direction::Receive); update_tuning_frequency(); update_antenna_bias(); @@ -141,7 +142,12 @@ void ReceiverModel::baseband_disable() { } void ReceiverModel::disable() { + enabled_ = false; + update_antenna_bias(); baseband_disable(); + + // TODO: Responsibility for enabling/disabling the radio is muddy. + // Some happens in ReceiverModel, some inside radio namespace. radio::disable(); } @@ -159,7 +165,7 @@ void ReceiverModel::update_tuning_frequency() { } void ReceiverModel::update_antenna_bias() { - radio::set_antenna_bias(antenna_bias_); + radio::set_antenna_bias(antenna_bias_ && enabled_); } void ReceiverModel::update_rf_amp() { diff --git a/firmware/application/receiver_model.hpp b/firmware/application/receiver_model.hpp index e13d76cb..ac3ce913 100644 --- a/firmware/application/receiver_model.hpp +++ b/firmware/application/receiver_model.hpp @@ -89,6 +89,7 @@ public: private: rf::Frequency frequency_step_ { 25000 }; + bool enabled_ { false }; bool rf_amp_ { false }; bool antenna_bias_ { false }; int32_t lna_gain_db_ { 32 };