mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 09:59:01 +00:00
Fix #85, we were stalling sometimes on send while in ISR which is NEVER legal
This commit is contained in:
parent
2fe145aed9
commit
8eb3045451
@ -54,6 +54,11 @@ ErrorCode CustomRF95::send(MeshPacket *p)
|
|||||||
DEBUG_MSG("immediate send on mesh fr=0x%x,to=0x%x,id=%d\n (txGood=%d,rxGood=%d,rxBad=%d)\n", p->from, p->to, p->id,
|
DEBUG_MSG("immediate send on mesh fr=0x%x,to=0x%x,id=%d\n (txGood=%d,rxGood=%d,rxBad=%d)\n", p->from, p->to, p->id,
|
||||||
txGood(), rxGood(), rxBad());
|
txGood(), rxGood(), rxBad());
|
||||||
|
|
||||||
|
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
||||||
|
|
||||||
|
if (!waitCAD())
|
||||||
|
return false; // Check channel activity
|
||||||
|
|
||||||
startSend(p);
|
startSend(p);
|
||||||
return ERRNO_OK;
|
return ERRNO_OK;
|
||||||
} else {
|
} else {
|
||||||
|
@ -280,17 +280,14 @@ void RH_RF95::clearRxBuf()
|
|||||||
ATOMIC_BLOCK_END;
|
ATOMIC_BLOCK_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Note: This routine might be called from inside the RF95 ISR
|
||||||
bool RH_RF95::send(const uint8_t *data, uint8_t len)
|
bool RH_RF95::send(const uint8_t *data, uint8_t len)
|
||||||
{
|
{
|
||||||
if (len > RH_RF95_MAX_MESSAGE_LEN)
|
if (len > RH_RF95_MAX_MESSAGE_LEN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
waitPacketSent(); // Make sure we dont interrupt an outgoing message
|
|
||||||
setModeIdle();
|
setModeIdle();
|
||||||
|
|
||||||
if (!waitCAD())
|
|
||||||
return false; // Check channel activity
|
|
||||||
|
|
||||||
// Position at the beginning of the FIFO
|
// Position at the beginning of the FIFO
|
||||||
spiWrite(RH_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
spiWrite(RH_RF95_REG_0D_FIFO_ADDR_PTR, 0);
|
||||||
// The headers
|
// The headers
|
||||||
|
Loading…
Reference in New Issue
Block a user