From d0da9ac73c45089d5f4e6d30a82a33a813a9b56c Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Tue, 7 Jan 2025 23:10:48 -0500 Subject: [PATCH] fix #322: scale bandscope for any number of samples retain stretch of bars for short ranges, but after 128, scale 1:1 to always fill the width of the screen. --- app/spectrum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index 57a7647..93fedeb 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -870,13 +870,14 @@ uint8_t Rssi2Y(uint16_t rssi) #ifdef ENABLE_FEAT_F4HWN_SPECTRUM static void DrawSpectrum() { + uint16_t steps = GetStepsCount(); uint8_t ox = 0; for (uint8_t i = 0; i < 128; ++i) { uint16_t rssi = rssiHistory[i >> settings.stepsCount]; if (rssi != RSSI_MAX_VALUE) { - uint8_t x = i * 128 / GetStepsCount(); + uint8_t x = i * 128 / ((steps > 128) ? 128 : steps) + 1; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true);