Skip to content

Commit

Permalink
fix frameAvailable race condition (ExpressLRS#2591)
Browse files Browse the repository at this point in the history
  • Loading branch information
JyeSmith authored Mar 19, 2024
1 parent b0f30c1 commit d48977e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/src/rx-serial/devSerialIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ static int timeout()

uint32_t duration = 10; // 10ms callback (i.e. when no theres no model match)
// only send frames if we have a model match
noInterrupts();
bool available = frameAvailable;
bool missed = frameMissed;
frameAvailable = false;
frameMissed = false;
interrupts();
if (connectionHasModelMatch)
{
duration = serialIO->sendRCFrame(frameAvailable, frameMissed, ChannelData);
duration = serialIO->sendRCFrame(available, missed, ChannelData);
}
frameAvailable = false;
frameMissed = false;
// still get telemetry and send link stats if theres no model match
serialIO->processSerialInput();
serialIO->sendQueuedData(serialIO->getMaxSerialWriteSize());
Expand Down

0 comments on commit d48977e

Please sign in to comment.