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);
}
}
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; } }