POCSAG Processor Rewrite (#1437)

* WIP Refactoring
* WordExtractor building
* Fix buffer sizes and squelch execute
* Move impls to cpp file
* Baud indicator
* WIP new bit extractor
* New approach for bit extraction.
* Code fit and finish
* Fix case on button
* Cleanup
* Adjust rate miss threshold
* Fix count bits error calculation.
This commit is contained in:
Kyle Reed 2023-09-08 10:41:09 -07:00 committed by GitHub
parent 9525738118
commit 31e8019642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 648 additions and 534 deletions

View file

@ -29,20 +29,19 @@ bool FMSquelch::execute(const buffer_f32_t& audio) {
return true;
}
// TODO: No hard-coded array size.
std::array<float, N> squelch_energy_buffer;
const buffer_f32_t squelch_energy{
squelch_energy_buffer.data(),
squelch_energy_buffer.size()};
// TODO: alloca temp buffer, assert audio.count
std::array<float, 32> squelch_energy_buffer;
const buffer_f32_t squelch_energy{squelch_energy_buffer.data(), audio.count};
non_audio_hpf.execute(audio, squelch_energy);
// "Non-audio" implies "noise" here. Find the loudest noise sample.
float non_audio_max_squared = 0;
for (const auto sample : squelch_energy_buffer) {
const float sample_squared = sample * sample;
if (sample_squared > non_audio_max_squared) {
for (size_t i = 0; i < squelch_energy.count; ++i) {
auto sample = squelch_energy.p[i];
float sample_squared = sample * sample;
if (sample_squared > non_audio_max_squared)
non_audio_max_squared = sample_squared;
}
}
// Is the noise less than the threshold?