mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 04:17:43 +00:00
Handle baseband::dma::wait_for_rx_buffer() returning empty buffer.
Was technically OK before, because sample count was zero. But seems silly (and vaguely dangerous) to call all that code with a nullptr.
This commit is contained in:
@@ -98,20 +98,22 @@ void BasebandThread::run() {
|
|||||||
while(true) {
|
while(true) {
|
||||||
// TODO: Place correct sampling rate into buffer returned here:
|
// TODO: Place correct sampling rate into buffer returned here:
|
||||||
const auto buffer_tmp = baseband::dma::wait_for_rx_buffer();
|
const auto buffer_tmp = baseband::dma::wait_for_rx_buffer();
|
||||||
buffer_c8_t buffer {
|
if( buffer_tmp ) {
|
||||||
buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate
|
buffer_c8_t buffer {
|
||||||
};
|
buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate
|
||||||
|
};
|
||||||
|
|
||||||
if( baseband_processor ) {
|
if( baseband_processor ) {
|
||||||
baseband_processor->execute(buffer);
|
baseband_processor->execute(buffer);
|
||||||
}
|
|
||||||
|
|
||||||
stats.process(buffer,
|
|
||||||
[](const BasebandStatistics& statistics) {
|
|
||||||
const BasebandStatisticsMessage message { statistics };
|
|
||||||
shared_memory.application_queue.push(message);
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
stats.process(buffer,
|
||||||
|
[](const BasebandStatistics& statistics) {
|
||||||
|
const BasebandStatisticsMessage message { statistics };
|
||||||
|
shared_memory.application_queue.push(message);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete baseband_buffer;
|
delete baseband_buffer;
|
||||||
|
@@ -92,6 +92,10 @@ struct buffer_t {
|
|||||||
timestamp { timestamp }
|
timestamp { timestamp }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator bool() const {
|
||||||
|
return (p != nullptr);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif/*__BUFFER_H__*/
|
#endif/*__BUFFER_H__*/
|
||||||
|
Reference in New Issue
Block a user