mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-16 19:43:01 +00:00
Fix LF/MF RX centering with adaptive FS4 tuning (#3319)
* Fix LF/MF RX tuning with adaptive FS4 shift * Enable adaptive FS4 tuning in Waterfall Designer
This commit is contained in:
@@ -45,6 +45,10 @@ void NarrowbandAMAudio::execute(const buffer_c8_t& buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only the processing thread applies frequency-only direction changes.
|
||||
if (requested_fs4_direction_.load(std::memory_order_relaxed) != applied_fs4_direction_)
|
||||
configure_fs4(decim_0_taps_);
|
||||
|
||||
const auto decim_0_out = decim_0.execute(buffer, dst_buffer);
|
||||
const auto audio_decim_0_out = audio_decim_0.execute(decim_0_out, dst_buffer);
|
||||
|
||||
@@ -125,8 +129,26 @@ buffer_f32_t NarrowbandAMAudio::demodulate(const buffer_c16_t& channel) {
|
||||
}
|
||||
}
|
||||
|
||||
void NarrowbandAMAudio::configure_fs4(const std::array<int16_t, 24>& taps) {
|
||||
// Keep the short first-stage update coherent with the processing thread.
|
||||
chSysLock();
|
||||
decim_0_taps_ = taps;
|
||||
const auto direction = requested_fs4_direction_.load(std::memory_order_relaxed);
|
||||
using Shift = dsp::decimate::FIRC8xR16x24FS4Decim4::Shift;
|
||||
decim_0.configure(decim_0_taps_, 33554432,
|
||||
direction == RxFs4Direction::Up ? Shift::Up : Shift::Down);
|
||||
applied_fs4_direction_ = direction;
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
void NarrowbandAMAudio::on_message(const Message* const message) {
|
||||
switch (message->id) {
|
||||
case Message::ID::RxFs4Config:
|
||||
requested_fs4_direction_.store(
|
||||
static_cast<const RxFs4ConfigMessage*>(message)->direction,
|
||||
std::memory_order_relaxed);
|
||||
break;
|
||||
|
||||
case Message::ID::UpdateSpectrum:
|
||||
case Message::ID::SpectrumStreamingConfig:
|
||||
channel_spectrum.on_message(message);
|
||||
@@ -162,7 +184,7 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
|
||||
constexpr size_t channel_filter_input_fs = decim_2_output_fs;
|
||||
// const size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
||||
|
||||
decim_0.configure(message.decim_0_filter.taps, 33554432);
|
||||
configure_fs4(message.decim_0_filter.taps);
|
||||
audio_decim_0.configure(taps_audio_wide_halfband_0.taps);
|
||||
translating_decim_1.configure(
|
||||
message.decim_1_filter.taps, audio_decim_0_output_fs);
|
||||
|
||||
Reference in New Issue
Block a user