mirror of https://github.com/FOME-Tech/fome-fw.git
consoleByteArrived uses std::atomic
This commit is contained in:
parent
b89afc170a
commit
94a5c52186
|
@ -496,9 +496,7 @@ void TunerstudioThread::ThreadTask() {
|
|||
// Until the end of time, process incoming messages.
|
||||
while (true) {
|
||||
if (tsProcessOne(channel) == 0) {
|
||||
onDataArrived(true);
|
||||
} else {
|
||||
onDataArrived(false);
|
||||
onDataArrived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,12 +44,6 @@
|
|||
#include "rusEfiFunctionalTest.h"
|
||||
#endif /*EFI_SIMULATOR */
|
||||
|
||||
bool consoleByteArrived = false;
|
||||
|
||||
void onDataArrived(bool valid) {
|
||||
consoleByteArrived = valid;
|
||||
}
|
||||
|
||||
CommandHandler console_line_callback;
|
||||
|
||||
void startConsole(CommandHandler console_line_callback_p) {
|
||||
|
|
|
@ -21,4 +21,4 @@ typedef void (*CommandHandler)(char *);
|
|||
|
||||
void consoleOutputBuffer(const uint8_t *buf, int size);
|
||||
void startConsole(CommandHandler console_line_callback_p);
|
||||
void onDataArrived(bool valid);
|
||||
void onDataArrived();
|
||||
|
|
|
@ -257,7 +257,11 @@ static bool isTriggerErrorNow() {
|
|||
#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */
|
||||
}
|
||||
|
||||
extern bool consoleByteArrived;
|
||||
static std::atomic<bool> consoleByteArrived = false;
|
||||
|
||||
void onDataArrived() {
|
||||
consoleByteArrived.store(true);
|
||||
}
|
||||
|
||||
class CommunicationBlinkingTask : public PeriodicTimerController {
|
||||
|
||||
|
@ -299,7 +303,8 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
|
|||
// differentiates software firmware error from critical interrupt error with CPU halt.
|
||||
offTimeMs = 50;
|
||||
onTimeMs = 450;
|
||||
} else if (consoleByteArrived) {
|
||||
} else if (consoleByteArrived.exchange(false)) {
|
||||
consoleByteArrived = false;
|
||||
offTimeMs = 100;
|
||||
onTimeMs = 33;
|
||||
#if EFI_INTERNAL_FLASH
|
||||
|
|
|
@ -47,3 +47,5 @@
|
|||
#else
|
||||
#include "chprintf.h"
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
|
|
Loading…
Reference in New Issue