From bd30a358eb20c92bf5e102d62568337511034c2d Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Mon, 6 Mar 2023 08:27:13 -1000 Subject: [PATCH] Fix free space check for remote commands and HEARTBEAT frames --- Firmware/LoRaSerial/Radio.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/LoRaSerial/Radio.ino b/Firmware/LoRaSerial/Radio.ino index a2da6e15..f9d67637 100644 --- a/Firmware/LoRaSerial/Radio.ino +++ b/Firmware/LoRaSerial/Radio.ino @@ -2351,7 +2351,7 @@ PacketType rcvDatagram() // * Received datagramType // * DATAGRAM_DUPLICATE // * DATAGRAM_BAD -PacketType validateDatagram(VIRTUAL_CIRCUIT * vc, PacketType datagramType, uint8_t ackNumber, uint16_t freeBytes) +PacketType validateDatagram(VIRTUAL_CIRCUIT * vc, PacketType datagramType, uint8_t ackNumber, int freeBytes) { if (ackNumber != vc->rmtTxAckNumber) { @@ -2389,12 +2389,12 @@ PacketType validateDatagram(VIRTUAL_CIRCUIT * vc, PacketType datagramType, uint8 } //Verify that there is sufficient space in the serialTransmitBuffer - if (inCommandMode || ((sizeof(serialTransmitBuffer) - availableTXBytes()) < rxDataBytes)) + if (inCommandMode || (freeBytes < rxDataBytes)) { if (settings.debugReceive || settings.debugDatagrams) { systemPrintTimestamp(); - systemPrintln("Insufficient space in the serialTransmitBuffer"); + systemPrintln("Insufficient space in the receive buffer"); } insufficientSpace++;