mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 11:47:43 +00:00
Workaround for Capture startup hang (#1285)
* Attempt to fix Capture startup hang * Pump baseband_queue on M4 startup * Synchronization experiment * Moved SpectrumCapture member, better hang detection for M0 * Prevent execute from working on members until class has been initialized. * Formatting * Remove workaround. * Rebase on next
This commit is contained in:
@@ -19,21 +19,18 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "event_m4.hpp"
|
||||
#include "debug.hpp"
|
||||
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include "message_queue.hpp"
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
#include "debug.hpp"
|
||||
#include "event_m4.hpp"
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
#include "message_queue.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
|
||||
using namespace lpc43xx;
|
||||
|
||||
extern "C" {
|
||||
|
||||
CH_IRQ_HANDLER(MAPP_IRQHandler) {
|
||||
@@ -61,6 +58,10 @@ void EventDispatcher::run() {
|
||||
|
||||
lpc43xx::creg::m0apptxevent::enable();
|
||||
|
||||
// Indicate to the M0 thread that
|
||||
// M4 is ready to receive message events.
|
||||
shared_memory.set_baseband_ready();
|
||||
|
||||
while (is_running) {
|
||||
const auto events = wait();
|
||||
dispatch(events);
|
||||
|
@@ -23,9 +23,7 @@
|
||||
#include "proc_capture.hpp"
|
||||
|
||||
#include "dsp_fir_taps.hpp"
|
||||
|
||||
#include "event_m4.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
CaptureProcessor::CaptureProcessor() {
|
||||
@@ -33,9 +31,13 @@ CaptureProcessor::CaptureProcessor() {
|
||||
decim_1.configure(taps_200k_decim_1.taps, 131072);
|
||||
|
||||
channel_spectrum.set_decimation_factor(1);
|
||||
ready = true;
|
||||
}
|
||||
|
||||
void CaptureProcessor::execute(const buffer_c8_t& buffer) {
|
||||
if (!ready)
|
||||
return;
|
||||
|
||||
/* 2.4576MHz, 2048 samples */
|
||||
const auto decim_0_out = decim_0.execute(buffer, dst_buffer);
|
||||
const auto decim_1_out = decim_1.execute(decim_0_out, dst_buffer);
|
||||
|
@@ -46,9 +46,13 @@ class CaptureProcessor : public BasebandProcessor {
|
||||
|
||||
private:
|
||||
// TODO: Repeated value needs to be transmitted from application side.
|
||||
size_t baseband_fs = 0;
|
||||
size_t baseband_fs = 3072000;
|
||||
static constexpr auto spectrum_rate_hz = 50.0f;
|
||||
|
||||
// HACK: BasebandThread starts immediately and starts sending data to members
|
||||
// before they are initialized. This is a workaround to prevent uninit data problems.
|
||||
bool ready = false;
|
||||
|
||||
BasebandThread baseband_thread{baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive};
|
||||
RSSIThread rssi_thread{NORMALPRIO + 10};
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class ReplayProcessor : public BasebandProcessor {
|
||||
void on_message(const Message* const message) override;
|
||||
|
||||
private:
|
||||
size_t baseband_fs = 0;
|
||||
size_t baseband_fs = 3072000;
|
||||
static constexpr auto spectrum_rate_hz = 50.0f;
|
||||
|
||||
BasebandThread baseband_thread{baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Transmit};
|
||||
|
@@ -42,7 +42,7 @@ class ReplayProcessor : public BasebandProcessor {
|
||||
void on_message(const Message* const message) override;
|
||||
|
||||
private:
|
||||
size_t baseband_fs = 0;
|
||||
size_t baseband_fs = 3072000;
|
||||
static constexpr auto spectrum_rate_hz = 50.0f;
|
||||
|
||||
BasebandThread baseband_thread{baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Transmit};
|
||||
|
Reference in New Issue
Block a user