Skip to content

Commit

Permalink
fix possible endless loop in CC1101
Browse files Browse the repository at this point in the history
Issue #320
  • Loading branch information
trilu2000 committed Feb 7, 2024
1 parent c7039d2 commit 7564545
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Radio-CC1101.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class CC1101 {
// switch to TX and wait till status has changed, will take approx 1ms
spi.strobe(CC1101_STX);
uint8_t i = 200;
while ((spi.readReg(CC1101_MARCSTATE, CC1101_STATUS) != MARCSTATE_TX) || (--i == 0)) {
while ((spi.readReg(CC1101_MARCSTATE, CC1101_STATUS) != MARCSTATE_TX) && (--i != 0)) {
_delay_us(100);
}

Expand Down Expand Up @@ -508,7 +508,7 @@ class CC1101 {

uint8_t waitRX() {
uint8_t i = 200;
while ((spi.readReg(CC1101_MARCSTATE, CC1101_STATUS) != MARCSTATE_RX) || (--i == 0)) {
while ((spi.readReg(CC1101_MARCSTATE, CC1101_STATUS) != MARCSTATE_RX) && (--i != 0)) {
_delay_us(200);
}
return i ? true : false;
Expand Down

0 comments on commit 7564545

Please sign in to comment.