From ba33cc737d4a8d815ae76eafe5eec65b36276b57 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 6 Jan 2016 11:36:57 -0800 Subject: [PATCH] Transmit DisplayFrameSync message, handle in WaterfallSpectrum. More kludginess, especially around initialization and timing. But it addresses the flickering lines of pixels at the bottom of the waterfall scroll area! --- firmware/application/main.cpp | 2 ++ firmware/application/ui_spectrum.cpp | 15 +++++++++++---- firmware/application/ui_spectrum.hpp | 1 + firmware/common/message.hpp | 10 +++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 8d8453bd6..cdbc1e207 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -197,6 +197,8 @@ private: } void handle_lcd_frame_sync() { + DisplayFrameSyncMessage message; + context.message_map().send(&message); painter.paint_widget_tree(top_widget); } diff --git a/firmware/application/ui_spectrum.cpp b/firmware/application/ui_spectrum.cpp index 824df9ff9..afb43e94c 100644 --- a/firmware/application/ui_spectrum.cpp +++ b/firmware/application/ui_spectrum.cpp @@ -240,16 +240,23 @@ void WaterfallWidget::on_show() { context().message_map().register_handler(Message::ID::FIFONotify, [this](const Message* const p) { const auto message = reinterpret_cast(p); - auto fifo = reinterpret_cast(message->fifo); - ChannelSpectrum channel_spectrum; - if( fifo->out(channel_spectrum) ) { - this->on_channel_spectrum(channel_spectrum); + this->fifo = reinterpret_cast(message->fifo); + } + ); + context().message_map().register_handler(Message::ID::DisplayFrameSync, + [this](const Message* const p) { + if( this->fifo ) { + ChannelSpectrum channel_spectrum; + while( fifo->out(channel_spectrum) ) { + this->on_channel_spectrum(channel_spectrum); + } } } ); } void WaterfallWidget::on_hide() { + context().message_map().unregister_handler(Message::ID::DisplayFrameSync); context().message_map().unregister_handler(Message::ID::FIFONotify); } diff --git a/firmware/application/ui_spectrum.hpp b/firmware/application/ui_spectrum.hpp index 21c4479e9..2d166bbf2 100644 --- a/firmware/application/ui_spectrum.hpp +++ b/firmware/application/ui_spectrum.hpp @@ -84,6 +84,7 @@ public: private: WaterfallView waterfall_view; FrequencyScale frequency_scale; + ChannelSpectrumFIFO* fifo; void on_channel_spectrum(const ChannelSpectrum& spectrum); }; diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index 26d2cc1a0..3f3b6f8c7 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -45,7 +45,7 @@ public: RSSIStatistics = 0, BasebandStatistics = 1, ChannelStatistics = 2, - + DisplayFrameSync = 3, AudioStatistics = 4, BasebandConfiguration = 5, TPMSPacket = 6, @@ -133,6 +133,14 @@ public: ChannelStatistics statistics; }; +class DisplayFrameSyncMessage : public Message { +public: + constexpr DisplayFrameSyncMessage( + ) : Message { ID::DisplayFrameSync } + { + } +}; + struct AudioStatistics { int32_t rms_db; int32_t max_db;