Skip to content

Commit

Permalink
more idiomatic code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Mar 2, 2023
1 parent 3896e04 commit 8ef714f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/onreceive/onreceive.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ void setup() {
}

void loop() {
#ifdef ESP8266
bool isRxPending = rxPending.load();
auto avail = testSerial.available();
if (isRxPending) {
rxPending.store(false);
}
#else
bool isRxPending = m_isrOverflow.exchange(false);
#endif
auto avail = testSerial.available();
if (isRxPending && !avail) {
// event fired on start bit, wait until first stop bit of longest frame
delayMicroseconds(1 + MAX_FRAMEBITS * 1000000 / BAUD_RATE);
Expand Down

0 comments on commit 8ef714f

Please sign in to comment.