Files
Luca b5d84fcc4d Airband VOR receiver and trasmitter (#3244)
* First test

* Reorder includes for consistency and fix string dereference in VorCdiIndicator

* Add memory section and linker script entry for vor_rx application

* Testing VOR TX

* Moving VOR TX to SD

* Code refactoring to align with guidelines

* Add TODO comment to verify radial sign convention in vor_tx_config

* Remove unnecessary set_dirty() calls in VorRxView methods

* Update Course Deviation Indicator label and adjust UI element positions

* Update VorTxView to run prepared image from memory map

* Update build condition in nightly release workflow to include workflow_dispatch event

* Reverting action changes

* Adjust Course Deviation Indicator layout and refine painting logic

* Refactor VorRxView UI elements for improved layout and clarity

* Add calibration field and update radial calculation logic in VorRxView

* Enhance VOR processing: add renormalization to phase oscillator, improve signal handling, and update configuration parameters

* Implement radial smoothing and TO/FROM state handling in VorRxView; update VOR processing logic

* Setting comments inline

* Refactor VorCdiIndicator and VorRxView: change normalize_signed_degrees to use int32_t, update radial smoothing to use fixed point arithmetic to reduce flash usage

* Update external app address end to 0xAE0B0000

* Update set_vor_tx_config to include enabled parameter for consistency

* Refactor VorRx to omit decim_2 stage and update comments for clarity on VOR processing

* Add RSSI, Channel, and Audio fields to VorRxView to mimic existing apps

* Refactor VorRxView labels and status messages

* Update VorRxView calibration field range to allow full circle input

* Completing Ident transmission logic

* Fixing TX gain and moving log label

* Refactor VOR phase calculations and update radial offset handling for accurate bearing representation

* Add low-pass filters to strip 9960 Hz subcarrier from audio output
2026-07-04 08:49:21 +02:00

131 lines
5.6 KiB
C++

/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2017 Furrtek
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __DSP_IIR_CONFIG_H__
#define __DSP_IIR_CONFIG_H__
#include "dsp_iir.hpp"
// scipy.signal.butter(2, 30 / 24000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_48k_hpf_30hz_config{
{0.99722705f, -1.99445410f, 0.99722705f},
{1.00000000f, -1.99444641f, 0.99446179f}};
// scipy.signal.butter(2, 300 / 24000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_48k_hpf_300hz_config{
{0.97261390f, -1.94522780f, 0.97261390f},
{1.00000000f, -1.94447766f, 0.94597794f}};
// scipy.signal.butter(2, 300 / 12000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_24k_hpf_300hz_config{
{0.94597686f, -1.89195371f, 0.94597686f},
{1.00000000f, -1.88903308f, 0.89487434f}};
// scipy.signal.butter(2, 30 / 12000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_24k_hpf_30hz_config{
{0.99446179f, -1.98892358f, 0.99446179f},
{1.00000000f, -1.98889291f, 0.98895425f}};
// scipy.signal.butter(2, 300 / 8000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_16k_hpf_300hz_config{
{0.92006616f, -1.84013232f, 0.92006616f},
{1.00000000f, -1.83373266f, 0.84653197f}};
// scipy.signal.butter(2, 300 / 6000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_12k_hpf_300hz_config{
{0.89485861f, -1.78971721f, 0.89485861f},
{1.00000000f, -1.77863178f, 0.80080265f}};
// scipy.signal.butter(2, 1500 / 6000.0, 'low', analog=False)
constexpr iir_biquad_config_t apt_audio_12k_lpf_1500hz_config{
// Added to lpf the apt audio in wefax mode , before sending to SD card or spk.
{0.09763107f, 0.19526215f, 0.09763107f},
{1.00000000f, -0.94280904f, 0.33333333f}};
// scipy.signal.butter(2, 300 / 4000.0, 'highpass', analog=False)
constexpr iir_biquad_config_t audio_8k_hpf_300hz_config{
{0.84645925f, -1.69291851f, 0.84645925f},
{1.00000000f, -1.66920314f, 0.71663387f}};
// scipy.signal.iirdesign(wp=8000 / 24000.0, ws= 4000 / 24000.0, gpass=1, gstop=18, ftype='ellip')
constexpr iir_biquad_config_t non_audio_hpf_config{
{0.51891061f, -0.95714180f, 0.51891061f},
{1.0f, -0.79878302f, 0.43960231f}};
// scipy.signal.butter(1, 300 / 24000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_48k_deemph_300_6_config{
{0.01925927f, 0.01925927f, 0.00000000f},
{1.00000000f, -0.96148145f, 0.00000000f}};
// scipy.signal.butter(1, 300 / 12000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_24k_deemph_300_6_config{
{0.03780475f, 0.03780475f, 0.00000000f},
{1.00000000f, -0.92439049f, 0.00000000f}};
// scipy.signal.butter(1, 300 / 8000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_16k_deemph_300_6_config{
{0.05568894f, 0.05568894f, 0.00000000f},
{1.00000000f, -0.88862213f, 0.00000000f}};
// scipy.signal.butter(1, 300 / 6000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_12k_deemph_300_6_config{
{0.07295966f, 0.07295966f, 0.00000000f},
{1.00000000f, -0.85408069f, 0.00000000f}};
// scipy.signal.butter(1, 300 / 4000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_8k_deemph_300_6_config{
{0.10583178f, 0.10583178f, 0.00000000f},
{1.00000000f, -0.78833643f, 0.00000000f}};
// 75us RC time constant, used in broadcast FM in Americas, South Korea
// scipy.signal.butter(1, 2122 / 24000.0, 'lowpass', analog=False)
// NOTE: Technically, order-1 filter, b[2] = a[2] = 0.
constexpr iir_biquad_config_t audio_48k_deemph_2122_6_config{
{0.12264116f, 0.12264116f, 0.00000000f},
{1.00000000f, -0.75471767f, 0.00000000f}};
// scipy.signal.iirnotch(f0, Q, fs) = signal.iirnotch(2400, 15, 12000)
constexpr iir_biquad_config_t apt_audio_12k_notch_2k4_config{
{0.95977357f, -0.59317269f, 0.95977357f},
{1.00000000f, -0.59317269f, 0.91954714f}};
// scipy.signal.butter(2, 2000 / 6000.0, 'low', analog=False)
constexpr iir_biquad_config_t apt_audio_12k_lpf_2000hz_config{
// Added to lpf the apt audio in NOAA mode , before sending to SD card or spk.
{0.15505103f, 0.31010205f, 0.15505103f},
{1.00000000f, -0.6202041f, 0.24040821f}};
// scipy.signal.butter(2, 3200 / 24000.0, 'low', analog=False)
// VOR RX audio low-pass. Removes the 9960 Hz FM subcarrier (the annoying
// high-pitch whine) while passing voice and the 1020 Hz ident tone. Cascade
// two of these sections for a 4th-order roll-off (~44 dB at 9960 Hz).
constexpr iir_biquad_config_t audio_48k_lpf_3200hz_config{
{0.03357181f, 0.06714362f, 0.03357181f},
{1.00000000f, -1.41898265f, 0.55326989f}};
#endif /*__DSP_IIR_CONFIG_H__*/