From 0f45a2fc43ad1ab9617356b8e7089925e0c8bc46 Mon Sep 17 00:00:00 2001 From: Reed Nightingale Date: Sat, 25 Apr 2020 12:17:15 -0700 Subject: [PATCH] Fix out-of-band midpoint selection --- bands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bands.cpp b/bands.cpp index 353e7a5..c9f04ad 100644 --- a/bands.cpp +++ b/bands.cpp @@ -94,7 +94,7 @@ uint32_t getFreqInBand(const uint32_t frequency, //We're not in a known band - just go to the center of the target band Band_t band; memcpy_P(&band,&bands[target_band_index],sizeof(band)); - return ((band.max - band.min)/2/100)*100;//truncated 100Hz + return band.min + ((band.max - band.min)/2/100)*100;//midpoint truncated to 100Hz resolution } else{ //We're in a known band. Match the relative position in the target band.