From 8a4564f6f5b385c36cb9883d3b12c9c1541b0a63 Mon Sep 17 00:00:00 2001 From: heurist1 Date: Mon, 1 Nov 2021 20:37:27 +0000 Subject: [PATCH] Slow down redraw Combine improvements and slow down refresh. --- firmware/application/apps/ui_adsb_rx.cpp | 2 +- firmware/baseband/proc_adsbrx.cpp | 37 +++++++++--------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/firmware/application/apps/ui_adsb_rx.cpp b/firmware/application/apps/ui_adsb_rx.cpp index 7196117bc..d50b3ed3a 100644 --- a/firmware/application/apps/ui_adsb_rx.cpp +++ b/firmware/application/apps/ui_adsb_rx.cpp @@ -304,8 +304,8 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) { } } + replace_entry(entry); - recent_entries_view.set_dirty(); logger = std::make_unique(); if (logger) { diff --git a/firmware/baseband/proc_adsbrx.cpp b/firmware/baseband/proc_adsbrx.cpp index 1dfaefa2d..33be8f02a 100644 --- a/firmware/baseband/proc_adsbrx.cpp +++ b/firmware/baseband/proc_adsbrx.cpp @@ -59,20 +59,12 @@ void ADSBRXProcessor::execute(const buffer_c8_t& buffer) { const ADSBFrameMessage message(frame); shared_memory.application_queue.push(message); decoding = false; - - if (prev_mag > mag) - bit = 1; - else - bit = 0; - + bit = (prev_mag > mag) ? 1 : 0; } else { //confidence = true; - if (prev_mag > mag) - bit = 1; - else - bit = 0; + bit = (prev_mag > mag) ? 1 : 0; } byte = bit | (byte << 1); @@ -88,11 +80,18 @@ void ADSBRXProcessor::execute(const buffer_c8_t& buffer) { if ( (bit_count == 8) && !(byte & (0x10<<3)) ) { msgLen = 56; // DFs 16 or greater are long 112. DFs 15 or less are short 56. } + + // Abondon all frames that arent DF17 + if ( (bit_count == 8) && ((byte>>3) != 17) ) { + decoding = false; + bit = (prev_mag > mag) ? 1 : 0; + frame.clear(); + } } // last bit of a byte } // Second sample of each bit sample_count++; } - + //else // Continue looking for preamble even if in a packet // switch is new preamble id higher magnitude { @@ -124,7 +123,7 @@ void ADSBRXProcessor::execute(const buffer_c8_t& buffer) { // the high levels as signals can be out of phase so part of the // energy can be in the near samples float thisAmp = (shifter[0] + shifter[2] + shifter[7] + shifter[9]); - float high = thisAmp / 6.0f; + float high = thisAmp / 7.0f; if (shifter[4] < high && shifter[5] < high) { @@ -137,18 +136,8 @@ void ADSBRXProcessor::execute(const buffer_c8_t& buffer) { shifter[13] < high && shifter[14] < high) { - bool newPacket = false; - if (decoding == false) - { - newPacket = true; - } - else if (decoding == true) - { - if(thisAmp > amp) - newPacket = true; - } - //if (c == ADSB_PREAMBLE_LENGTH) { - if (newPacket == true) + if ( (decoding == false) || // New preamble + ((decoding == true)&& (thisAmp > amp)) ) // Higher power than existing packet { decoding = true; msgLen = 112;