diff --git a/app/spectrum.c b/app/spectrum.c index 57a7647..6a0e799 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -870,13 +870,20 @@ uint8_t Rssi2Y(uint16_t rssi) #ifdef ENABLE_FEAT_F4HWN_SPECTRUM static void DrawSpectrum() { + uint16_t steps = GetStepsCount(); + // max bars at 128 to correctly draw larger numbers of samples + uint8_t bars = (steps > 128) ? 128 : steps; + // shift to center bar on freq marker + uint8_t shift_graph = 64 / steps + 1; + 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(); + // stretch bars to fill the screen width + uint8_t x = i * 128 / bars + shift_graph; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true);