[fix](trx-vdes): force long bursts to finalize
Keep the current VDES thresholds but restore a maximum burst duration so continuously open detections still produce frames. Co-authored-by: Stan Grams <sjg@haxx.space> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -22,6 +22,7 @@ use trx_core::decode::VdesMessage;
|
|||||||
const VDES_SYMBOL_RATE: f32 = 76_800.0;
|
const VDES_SYMBOL_RATE: f32 = 76_800.0;
|
||||||
const MIN_BURST_MS: f32 = 1.5;
|
const MIN_BURST_MS: f32 = 1.5;
|
||||||
const BURST_END_MS: f32 = 0.35;
|
const BURST_END_MS: f32 = 0.35;
|
||||||
|
const MAX_BURST_MS: f32 = 45.0;
|
||||||
const MIN_BURST_SYMBOLS: usize = 64;
|
const MIN_BURST_SYMBOLS: usize = 64;
|
||||||
const TER_MCS1_100_BURST_SYMBOLS: usize = 1_984;
|
const TER_MCS1_100_BURST_SYMBOLS: usize = 1_984;
|
||||||
const TER_MCS1_100_RAMP_SYMBOLS: usize = 32;
|
const TER_MCS1_100_RAMP_SYMBOLS: usize = 32;
|
||||||
@@ -73,6 +74,8 @@ impl VdesDecoder {
|
|||||||
((self.sample_rate * (MIN_BURST_MS / 1000.0)).round() as usize).max(16);
|
((self.sample_rate * (MIN_BURST_MS / 1000.0)).round() as usize).max(16);
|
||||||
let quiet_limit =
|
let quiet_limit =
|
||||||
((self.sample_rate * (BURST_END_MS / 1000.0)).round() as u32).max(4);
|
((self.sample_rate * (BURST_END_MS / 1000.0)).round() as u32).max(4);
|
||||||
|
let max_burst_samples =
|
||||||
|
((self.sample_rate * (MAX_BURST_MS / 1000.0)).round() as usize).max(min_burst_samples);
|
||||||
|
|
||||||
for &sample in samples {
|
for &sample in samples {
|
||||||
let power = sample.norm_sqr();
|
let power = sample.norm_sqr();
|
||||||
@@ -96,6 +99,16 @@ impl VdesDecoder {
|
|||||||
self.quiet_run = 0;
|
self.quiet_run = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.burst_samples.len() >= max_burst_samples {
|
||||||
|
if let Some(msg) = self.finalize_burst(channel) {
|
||||||
|
out.push(msg);
|
||||||
|
}
|
||||||
|
self.in_burst = false;
|
||||||
|
self.quiet_run = 0;
|
||||||
|
self.burst_samples.clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if self.quiet_run >= quiet_limit {
|
if self.quiet_run >= quiet_limit {
|
||||||
if self.burst_samples.len() >= min_burst_samples {
|
if self.burst_samples.len() >= min_burst_samples {
|
||||||
if let Some(msg) = self.finalize_burst(channel) {
|
if let Some(msg) = self.finalize_burst(channel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user