diff --git a/firmware/baseband/proc_wideband_spectrum.cpp b/firmware/baseband/proc_wideband_spectrum.cpp index feb29f69..e9112115 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 c8401e32..72179633 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__*/