new receive code works a little better

This commit is contained in:
geeksville
2020-04-30 13:50:40 -07:00
parent 22720e9f63
commit a2ba9d3c44
6 changed files with 49 additions and 21 deletions

View File

@@ -124,16 +124,24 @@ void RadioLibInterface::handleTransmitInterrupt()
{
assert(sendingPacket); // Were we sending?
// FIXME - check result code from ISR
completeSending();
}
// We are done sending that packet, release it
packetPool.release(sendingPacket);
sendingPacket = NULL;
// DEBUG_MSG("Done with send\n");
void RadioLibInterface::completeSending()
{
if (sendingPacket) {
// We are done sending that packet, release it
packetPool.release(sendingPacket);
sendingPacket = NULL;
// DEBUG_MSG("Done with send\n");
}
}
void RadioLibInterface::handleReceiveInterrupt()
{
assert(isReceiving);
isReceiving = false;
// read the number of actually received bytes
size_t length = iface.getPacketLength();
@@ -179,4 +187,3 @@ void RadioLibInterface::startSend(MeshPacket *txp)
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register bits
enableInterrupt(isrTxLevel0);
}