diff --git a/firmware/application/ui_console.cpp b/firmware/application/ui_console.cpp index f23f4ce4..0c299acd 100644 --- a/firmware/application/ui_console.cpp +++ b/firmware/application/ui_console.cpp @@ -32,6 +32,7 @@ void Console::clear() { Color::black() ); pos = { 0, 0 }; + display.scroll_set_position(0); } void Console::write(const std::string message) { @@ -64,10 +65,10 @@ void Console::paint(Painter& painter) { } void Console::on_show() { - clear(); - const auto screen_r = screen_rect(); display.scroll_set_area(screen_r.top(), screen_r.bottom()); + + clear(); } void Console::on_hide() { diff --git a/firmware/application/ui_receiver.cpp b/firmware/application/ui_receiver.cpp index 9142aa20..59721630 100644 --- a/firmware/application/ui_receiver.cpp +++ b/firmware/application/ui_receiver.cpp @@ -504,13 +504,7 @@ void ReceiverView::on_hide() { context().message_map.unregister_handler(Message::ID::FSKPacket); } -void ReceiverView::set_parent_rect(const Rect new_parent_rect) { - const ui::Dim header_height = 3 * 16; - waterfall.set_parent_rect({ - 0, header_height, - new_parent_rect.width(), static_cast(new_parent_rect.height() - header_height) - }); } void ReceiverView::focus() { @@ -568,7 +562,6 @@ void ReceiverView::on_modulation_changed(int32_t modulation) { break; } - waterfall.clear(); } void ReceiverView::on_show_options_frequency() { diff --git a/firmware/application/ui_receiver.hpp b/firmware/application/ui_receiver.hpp index 8cafb977..99626981 100644 --- a/firmware/application/ui_receiver.hpp +++ b/firmware/application/ui_receiver.hpp @@ -363,8 +363,6 @@ public: ReceiverView(NavigationView& nav, ReceiverModel& receiver_model); ~ReceiverView(); - void set_parent_rect(const Rect new_parent_rect) override; - void focus() override; void on_show() override; diff --git a/firmware/application/ui_spectrum.hpp b/firmware/application/ui_spectrum.hpp index cc1fa314..e481d45f 100644 --- a/firmware/application/ui_spectrum.hpp +++ b/firmware/application/ui_spectrum.hpp @@ -40,6 +40,10 @@ namespace spectrum { class FrequencyScale : public Widget { public: + void on_show() override { + clear(); + } + void set_spectrum_sampling_rate(const uint32_t new_sampling_rate, const size_t new_spectrum_bins) { if( (spectrum_sampling_rate != new_sampling_rate) || (spectrum_bins != new_spectrum_bins) ) { @@ -75,12 +79,6 @@ public: draw_frequency_ticks(painter, r); } - void clear() { - spectrum_sampling_rate = 0; - spectrum_bins = 0; - set_dirty(); - } - private: static constexpr Dim filter_band_height = 4; @@ -89,6 +87,12 @@ private: uint32_t channel_filter_pass_frequency { 0 }; uint32_t channel_filter_stop_frequency { 0 }; + void clear() { + spectrum_sampling_rate = 0; + spectrum_bins = 0; + set_dirty(); + } + void clear_background(Painter& painter, const Rect r) { painter.fill_rectangle(r, Color::black()); } @@ -187,6 +191,8 @@ private: class WaterfallView : public Widget { public: void on_show() override { + clear(); + const auto screen_r = screen_rect(); display.scroll_set_area(screen_r.top(), screen_r.bottom()); } @@ -203,13 +209,6 @@ public: (void)painter; } - void clear() { - display.fill_rectangle( - screen_rect(), - Color::black() - ); - } - void on_channel_spectrum( const ChannelSpectrum& spectrum ) { @@ -233,6 +232,14 @@ public: pixel_row ); } + +private: + void clear() { + display.fill_rectangle( + screen_rect(), + Color::black() + ); + } }; class WaterfallWidget : public View { @@ -273,11 +280,6 @@ public: (void)painter; } - void clear() { - waterfall_view.clear(); - frequency_scale.clear(); - } - private: WaterfallView waterfall_view; FrequencyScale frequency_scale;