From 4cec8b80a32b6b12a7595a4b89b3895f35eed233 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 24 Jul 2018 09:42:07 -0400 Subject: [PATCH] Check offsets above and below 5Hz --- mainwindow.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 1a6c4af..f57076b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -223,6 +223,22 @@ namespace } } + int round(int numToRound, int multiple) + { + if(multiple == 0) + { + return numToRound; + } + + int roundDown = ( (int) (numToRound) / multiple) * multiple; + + if(numToRound - roundDown > multiple/2){ + return roundDown + multiple; + } + + return roundDown; + } + int roundUp(int numToRound, int multiple) { if(multiple == 0) @@ -3201,7 +3217,9 @@ void MainWindow::readFromStdout() //readFromStdout int offset = decodedtext.frequencyOffset(); if(!m_bandActivity.contains(offset)){ - QList offsets = {offset - 1, offset - 2, offset - 3, offset + 1, offset + 2, offset + 3}; + QList offsets = { + offset - 1, offset - 2, offset - 3, offset - 4, offset - 5, + offset + 1, offset + 2, offset + 3, offset + 4, offset + 5}; foreach(int prevOffset, offsets){ if(!m_bandActivity.contains(prevOffset)){ continue; } m_bandActivity[offset] = m_bandActivity[prevOffset];