From 3ae53701347198d64e8e7bd5dfc5f7419fae88c7 Mon Sep 17 00:00:00 2001 From: Egor Shitikov Date: Thu, 1 Aug 2024 13:57:58 -0700 Subject: [PATCH] fix zerro start fr and diapazone titles --- src/main.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f1d98da..747e5b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,9 +26,9 @@ // TODO: if % RANGE_PER_PAGE 1= 0 #define FREQ_END 950 -// Feature to scan diapazones. Other frequency settings will be ignored. -int SCAN_DIAPAZONES[] = {}; -//int SCAN_DIAPAZONES[] = {850890, 920950}; +// Feature to scan diapazones. Other frequency settings will be ignored. +int SCAN_DIAPAZONES[] = {}; +// int SCAN_DIAPAZONES[] = {850890, 920950}; // MHZ per page // to put everething into one page set RANGE_PER_PAGE = FREQ_END - 800 @@ -321,6 +321,16 @@ void displayDecorate(int begin = 0, int end = 0, bool redraw = false) display.setTextAlignment(TEXT_ALIGN_RIGHT); display.drawString(128, STATUS_TEXT_TOP, String(FREQ_END)); } + else if (diapazones_count > 0) + { + display.setTextAlignment(TEXT_ALIGN_LEFT); + display.drawString(0, STATUS_TEXT_TOP, String(SCAN_DIAPAZONES[i] / 1000) + "-" + String(SCAN_DIAPAZONES[i] % 1000)); + if (i + 1 < iterations) + { + display.setTextAlignment(TEXT_ALIGN_RIGHT); + display.drawString(128, STATUS_TEXT_TOP, String(SCAN_DIAPAZONES[i + 1] / 1000) + "-" + String(SCAN_DIAPAZONES[i + 1] % 1000)); + } + } if (!initialized) { @@ -510,7 +520,6 @@ void loop() for (i = 0; i < iterations; i++) { range = RANGE_PER_PAGE; - drone_detected_freqancy_start = 0; if (diapazones_count == 0) { @@ -535,6 +544,8 @@ void loop() displayDecorate(fr_begin, fr_end, true); } + drone_detected_freqancy_start = 0; + display.setTextAlignment(TEXT_ALIGN_RIGHT); // horizontal x assix loop for (x = 0; x < STEPS; x++) @@ -579,7 +590,7 @@ void loop() { if (result[y] && (result[y + 1] > 0 && result[y - 1] > 0)) { - //Filling the empty pixel between signals int the level < 27 (noise level) + // Filling the empty pixel between signals int the level < 27 (noise level) /* if (y < 27 && result[y + 1] == 0 && result[y + 2] > 0) { result[y + 1] = 1; @@ -619,7 +630,7 @@ void loop() } drone_detected_freqancy_end = freq; led_flag = true; - //If level is set to sensitive, start beeping every 10th frequency and shorter + // If level is set to sensitive, start beeping every 10th frequency and shorter if (drone_detection_level <= 25) { if (detection_count == 1 && SOUND_ON)