diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /FoxGuardBands.cpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'FoxGuardBands.cpp')
| -rw-r--r-- | FoxGuardBands.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/FoxGuardBands.cpp b/FoxGuardBands.cpp new file mode 100644 index 00000000..18375e1f --- /dev/null +++ b/FoxGuardBands.cpp @@ -0,0 +1,54 @@ +#include "FoxGuardBands.hpp" + +#include <QtGlobal> + +namespace +{ + using Radio::Frequency; + + FoxGuardBands::Match no_match () + { + return {false, FoxGuardBands::GuardKind::None, 0}; + } +} + +namespace FoxGuardBands +{ + Match check (Frequency dial_frequency, + std::initializer_list<Frequency> standard_ft8_guards, + std::initializer_list<Frequency> wspr_guards) + { + for (auto guard_frequency : standard_ft8_guards) + { + auto const offset = static_cast<qint64> (dial_frequency) - static_cast<qint64> (guard_frequency); + if (qAbs (offset) < 3000) + { + return {true, GuardKind::StandardFT8, guard_frequency}; + } + } + + for (auto guard_frequency : wspr_guards) + { + auto const offset = static_cast<qint64> (dial_frequency) - static_cast<qint64> (guard_frequency); + if (offset > -3500 && offset < 300) + { + return {true, GuardKind::WSPR, guard_frequency}; + } + } + + return no_match (); + } + + Match check (Frequency dial_frequency) + { + return check (dial_frequency, + { + 1840000, 3573000, 7074000, 10136000, 14074000, 18100000, + 21074000, 24915000, 28074000, 50313000, 70154000 + }, + { + 1836600, 5364700, 3568600, 7038600, 10138700, 14095600, + 18104600, 21094600, 24924600, 28124600 + }); + } +} |
