Added wefax offset to audio app too. (#2572)

* added wefax offset to audio app too.

* moved from head to cpp
This commit is contained in:
Totoo 2025-03-19 23:03:04 +01:00 committed by GitHub
parent ff2f27e297
commit d73db884f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

@ -265,6 +265,7 @@ void AnalogAudioView::set_spec_trigger(uint16_t trigger) {
}
AnalogAudioView::~AnalogAudioView() {
receiver_model.set_hidden_offset(0);
audio::output::stop();
receiver_model.disable();
baseband::shutdown();
@ -431,6 +432,8 @@ void AnalogAudioView::update_modulation(ReceiverModel::Mode modulation) {
receiver_model.set_sampling_rate(is_wideband_spectrum_mode ? spec_bw : 3072000);
receiver_model.set_baseband_bandwidth(is_wideband_spectrum_mode ? spec_bw / 2 : 1750000);
receiver_model.set_hidden_offset(modulation == ReceiverModel::Mode::AMAudioFMApt ? -2200 : 0); // wefax needs to be shifted, see wefax rx app.
receiver_model.enable();
// TODO: This doesn't belong here! There's a better way.

View file

@ -282,6 +282,11 @@ void ReceiverModel::update_tuning_frequency() {
radio::set_tuning_frequency(target_frequency() + hidden_offset + tuning_offset());
}
void ReceiverModel::set_hidden_offset(rf::Frequency offset) {
hidden_offset = offset;
update_tuning_frequency();
}
void ReceiverModel::update_baseband_bandwidth() {
radio::set_baseband_filter_bandwidth_rx(baseband_bandwidth());
}

View file

@ -110,7 +110,7 @@ class ReceiverModel {
uint8_t normalized_headphone_volume() const;
void set_normalized_headphone_volume(uint8_t v);
void set_hidden_offset(rf::Frequency offset) { hidden_offset = offset; }
void set_hidden_offset(rf::Frequency offset);
void enable();
void disable();