From 2f01dd0118edb6c7f23e76d12c1a8e9ceb960145 Mon Sep 17 00:00:00 2001 From: KD Diallo Date: Tue, 13 Jan 2026 11:51:00 +0100 Subject: [PATCH] Fix spectrum visualisation for edge cases --- App/app/spectrum.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/App/app/spectrum.c b/App/app/spectrum.c index 9d30f6fe..64fb814f 100644 --- a/App/app/spectrum.c +++ b/App/app/spectrum.c @@ -950,16 +950,16 @@ uint8_t Rssi2Y(uint16_t rssi) // Total width units = (bars - 1) full bars + 2 half bars = bars // First bar: half width, middle bars: full width, last bar: half width // Scale: 128 pixels / (bars - 1) = pixels per full bar - uint16_t fullWidth = 128 * 2 / (bars - 1); // x2 for precision + uint16_t fullWidth = (128 << 8) / (bars - 1); // x256 for precision if (i == 0) { - x = fullWidth / 4; // half of half (because fullWidth is x2) + x = fullWidth / (2 << 8); // half of /256 (because fullWidth is x256) } else { // Position = half + (i-1) full bars + current bar - x = fullWidth / 4 + (uint16_t)i * fullWidth / 2; + x = fullWidth / (2 << 8) + (uint16_t)i * fullWidth / (1 << 8); if (i == bars - 1) x = 128; // Last bar ends at screen edge } }