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!
This commit is contained in:
Jared Boone 2016-01-06 11:36:57 -08:00
parent aaa1bc3a09
commit ba33cc737d
4 changed files with 23 additions and 5 deletions

View File

@ -197,6 +197,8 @@ private:
}
void handle_lcd_frame_sync() {
DisplayFrameSyncMessage message;
context.message_map().send(&message);
painter.paint_widget_tree(top_widget);
}

View File

@ -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<const FIFONotifyMessage*>(p);
auto fifo = reinterpret_cast<ChannelSpectrumFIFO*>(message->fifo);
ChannelSpectrum channel_spectrum;
if( fifo->out(channel_spectrum) ) {
this->on_channel_spectrum(channel_spectrum);
this->fifo = reinterpret_cast<ChannelSpectrumFIFO*>(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);
}

View File

@ -84,6 +84,7 @@ public:
private:
WaterfallView waterfall_view;
FrequencyScale frequency_scale;
ChannelSpectrumFIFO* fifo;
void on_channel_spectrum(const ChannelSpectrum& spectrum);
};

View File

@ -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;