Fix baseband thread init order bug for all procs. (#1293)

This commit is contained in:
Kyle Reed 2023-07-22 23:54:17 -07:00 committed by GitHub
parent 828eb67a52
commit 7bd370b5bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 226 additions and 174 deletions

View file

@ -32,16 +32,25 @@ WORKING_AREA(rssi_thread_wa, 128);
Thread* RSSIThread::thread = nullptr;
RSSIThread::RSSIThread(const tprio_t priority) {
thread = chThdCreateStatic(rssi_thread_wa, sizeof(rssi_thread_wa),
priority, ThreadBase::fn,
this);
RSSIThread::RSSIThread(bool auto_start, tprio_t priority)
: priority_{priority} {
if (auto_start) start();
}
RSSIThread::~RSSIThread() {
chThdTerminate(thread);
chThdWait(thread);
thread = nullptr;
if (thread) {
chThdTerminate(thread);
chThdWait(thread);
thread = nullptr;
}
}
void RSSIThread::start() {
if (!thread) {
thread = chThdCreateStatic(
rssi_thread_wa, sizeof(rssi_thread_wa),
priority_, ThreadBase::fn, this);
}
}
void RSSIThread::run() {