Fix LoRa TX killed by receive() after handle_incoming (untested)
Some checks failed
PlatformIO Build / build (push) Failing after 13m14s
PlatformIO Build / release (push) Has been skipped

This commit is contained in:
DeFiDude
2026-03-21 02:19:07 -06:00
parent 87723e891a
commit 6f8e53c060

View File

@@ -139,8 +139,13 @@ void LoRaInterface::loop() {
memcpy(buf.writable(payloadSize), raw + RNODE_HEADER_L, payloadSize);
InterfaceImpl::handle_incoming(buf);
// Re-enter RX
_radio->receive();
// Re-enter RX — but only if handle_incoming didn't trigger a TX.
// handle_incoming() can synchronously call send_outgoing() (for link
// proofs, path responses), which starts an async TX via endPacket(true).
// Calling receive() here would abort that TX (clears IRQ flags + enters RX).
if (!_txPending) {
_radio->receive();
}
} else if (packetSize > 0) {
// Packet too small (only header, no payload) — discard
Serial.printf("[LORA_IF] RX runt packet (%d bytes), discarding\n", packetSize);