Merge pull request #539 from liamcottle/fix/missed-packets

Start receive immediately after packet received
This commit is contained in:
ripplebiz 2025-07-20 21:57:44 +10:00 committed by GitHub
commit 0a9da09a67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -96,8 +96,9 @@ bool RadioLibWrapper::isInRecvMode() const {
} }
int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) { int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
int len = 0;
if (state & STATE_INT_READY) { if (state & STATE_INT_READY) {
int len = _radio->getPacketLength(); len = _radio->getPacketLength();
if (len > 0) { if (len > 0) {
if (len > sz) { len = sz; } if (len > sz) { len = sz; }
int err = _radio->readData(bytes, len); int err = _radio->readData(bytes, len);
@ -110,7 +111,6 @@ int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
} }
} }
state = STATE_IDLE; // need another startReceive() state = STATE_IDLE; // need another startReceive()
return len;
} }
if (state != STATE_RX) { if (state != STATE_RX) {
@ -121,7 +121,7 @@ int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) {
MESH_DEBUG_PRINTLN("RadioLibWrapper: error: startReceive(%d)", err); MESH_DEBUG_PRINTLN("RadioLibWrapper: error: startReceive(%d)", err);
} }
} }
return 0; return len;
} }
uint32_t RadioLibWrapper::getEstAirtimeFor(int len_bytes) { uint32_t RadioLibWrapper::getEstAirtimeFor(int len_bytes) {