From 1f3c182b7f4ef4eb8fbaeaddecf76c63724a0374 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 11 Jan 2016 16:31:49 -0800 Subject: [PATCH] Add missing message handler for wideband spectrum. Spectrum processing was not enabled, and hence wideband spectrum was not being displayed. --- firmware/baseband/proc_wideband_spectrum.cpp | 19 ++++++++++++++++++- firmware/baseband/proc_wideband_spectrum.hpp | 4 ++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/firmware/baseband/proc_wideband_spectrum.cpp b/firmware/baseband/proc_wideband_spectrum.cpp index feb29f695..e91121154 100644 --- a/firmware/baseband/proc_wideband_spectrum.cpp +++ b/firmware/baseband/proc_wideband_spectrum.cpp @@ -64,7 +64,24 @@ void WidebandSpectrum::execute(const buffer_c8_t& buffer) { } void WidebandSpectrum::on_message(const Message* const message) { - if( message->id == Message::ID::UpdateSpectrum ) { + switch(message->id) { + case Message::ID::UpdateSpectrum: channel_spectrum.update(); + break; + + case Message::ID::SpectrumStreamingConfig: + streaming_config(*reinterpret_cast(message)); + break; + + default: + break; + } +} + +void WidebandSpectrum::streaming_config(const SpectrumStreamingConfigMessage& message) { + if( message.mode == SpectrumStreamingConfigMessage::Mode::Running ) { + channel_spectrum.start(); + } else { + channel_spectrum.stop(); } } diff --git a/firmware/baseband/proc_wideband_spectrum.hpp b/firmware/baseband/proc_wideband_spectrum.hpp index c8401e32e..72179633c 100644 --- a/firmware/baseband/proc_wideband_spectrum.hpp +++ b/firmware/baseband/proc_wideband_spectrum.hpp @@ -25,6 +25,8 @@ #include "baseband_processor.hpp" #include "spectrum_collector.hpp" +#include "message.hpp" + #include #include #include @@ -39,6 +41,8 @@ private: SpectrumCollector channel_spectrum; std::array spectrum; + + void streaming_config(const SpectrumStreamingConfigMessage& message); }; #endif/*__PROC_WIDEBAND_SPECTRUM_H__*/