adafruit / RadioHead

A github'ified version of http://www.airspayce.com/mikem/arduino/RadioHead/
Other
186 stars 115 forks source link

RF95 possible bug in TX/RX VS IRQ? #38

Open dekeln opened 4 years ago

dekeln commented 4 years ago

Hi, is it possible that the ISR will occur before setting '_mode' to 'RHModeRx'/'RHModeTx' inside 'setModeRx'/'setModeTx' (in case there are more ISR which loads the CPU)?

maybe the setModeTx should be like: void RH_RF95::setModeTx() { if (_mode != RHModeTx) { _mode = RHModeTx; spiWrite(RH_RF95_REG_40_DIO_MAPPING1, 0x40); // Interrupt on TxDone spiWrite(RH_RF95_REG_01_OP_MODE, RH_RF95_MODE_TX); } }

instead of: void RH_RF95::setModeTx() { if (_mode != RHModeTx) { spiWrite(RH_RF95_REG_01_OP_MODE, RH_RF95_MODE_TX); spiWrite(RH_RF95_REG_40_DIO_MAPPING1, 0x40); // Interrupt on TxDone _mode = RHModeTx; } }