From 63c4a60cf767aa3fe527a90d698b88ed7dec3060 Mon Sep 17 00:00:00 2001 From: furrtek Date: Mon, 21 May 2018 20:56:04 +0100 Subject: [PATCH] Fixed scrolling/FFT view glitch when going back to analog audio rx --- firmware/application/ui/ui_spectrum.cpp | 5 ++++- firmware/application/ui/ui_spectrum.hpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/application/ui/ui_spectrum.cpp b/firmware/application/ui/ui_spectrum.cpp index 912ce10c..c108ec53 100644 --- a/firmware/application/ui/ui_spectrum.cpp +++ b/firmware/application/ui/ui_spectrum.cpp @@ -352,7 +352,10 @@ void WaterfallWidget::set_parent_rect(const Rect new_parent_rect) { waterfall_reduced_rect = { 0, scale_height, new_parent_rect.width(), new_parent_rect.height() - scale_height - audio_spectrum_height }; frequency_scale.set_parent_rect({ 0, 0, new_parent_rect.width(), scale_height }); - waterfall_view.set_parent_rect(waterfall_normal_rect); + if (fft_widget) + waterfall_view.set_parent_rect(waterfall_reduced_rect); + else + waterfall_view.set_parent_rect(waterfall_normal_rect); waterfall_view.on_show(); fft_widget_rect = { 0, new_parent_rect.height() - audio_spectrum_height, new_parent_rect.width(), audio_spectrum_height }; diff --git a/firmware/application/ui/ui_spectrum.hpp b/firmware/application/ui/ui_spectrum.hpp index 425a347c..b2660270 100644 --- a/firmware/application/ui/ui_spectrum.hpp +++ b/firmware/application/ui/ui_spectrum.hpp @@ -105,6 +105,7 @@ public: private: void on_tick_second(); + //static constexpr ui::Dim audio_spectrum_scale_height = 16 + 2; static constexpr ui::Dim audio_spectrum_height = 2 * 16; WaterfallView waterfall_view { }; @@ -149,7 +150,7 @@ private: if( this->audio_fifo ) { AudioSpectrum audio_spectrum; while( audio_fifo->out(audio_spectrum) ) { - // Unstack everything until and only use last buffer (should only be one max. ready per frame) + // Unstack everything available and only use last buffer (should only be one max. ready per frame) } this->on_audio_spectrum(audio_spectrum); }