mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 03:37:50 +00:00
ChannelSpectrumConfig message subsumes FIFONotify.
Separate channel spectrum config from spectrum data. This will permit sending config info only when necessary. Use type information of ChannelSpectrum to statically define number of FFT bins elsewhere. TODO: Posting configuration message way too often. Fixing that is the next step.
This commit is contained in:
@@ -48,6 +48,7 @@ void SpectrumCollector::feed(
|
||||
// Called from baseband processing thread.
|
||||
channel_filter_pass_frequency = filter_pass_frequency;
|
||||
channel_filter_stop_frequency = filter_stop_frequency;
|
||||
post_configuration_message();
|
||||
channel_spectrum_decimator.feed(
|
||||
channel,
|
||||
[this](const buffer_c16_t& data) {
|
||||
@@ -66,6 +67,16 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
|
||||
}
|
||||
}
|
||||
|
||||
void SpectrumCollector::post_configuration_message() {
|
||||
ChannelSpectrumConfigMessage message {
|
||||
channel_spectrum_sampling_rate,
|
||||
channel_filter_pass_frequency,
|
||||
channel_filter_stop_frequency,
|
||||
&fifo
|
||||
};
|
||||
shared_memory.application_queue.push(message);
|
||||
}
|
||||
|
||||
void SpectrumCollector::update() {
|
||||
// Called from idle thread (after EVT_MASK_SPECTRUM is flagged)
|
||||
if( channel_spectrum_request_update ) {
|
||||
@@ -85,13 +96,6 @@ void SpectrumCollector::update() {
|
||||
spectrum.db[i] = std::max(0U, std::min(255U, v));
|
||||
}
|
||||
|
||||
/* TODO: Rename .db -> .magnitude, or something more (less!) accurate. */
|
||||
spectrum.db_count = spectrum.db.size();
|
||||
spectrum.sampling_rate = channel_spectrum_sampling_rate;
|
||||
spectrum.channel_filter_pass_frequency = channel_filter_pass_frequency;
|
||||
spectrum.channel_filter_stop_frequency = channel_filter_stop_frequency;
|
||||
fifo.in(spectrum);
|
||||
FIFONotifyMessage message { &fifo };
|
||||
shared_memory.application_queue.push(message);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user