From ec59f7d7dd3a937144e7c656a8bba5f2a174e92f Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:59:44 +0100 Subject: [PATCH] fix packet queue full (#6292) --- src/mesh/api/PacketAPI.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 45bbe19d3..4f0fbaf97 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -89,18 +89,20 @@ bool PacketAPI::receivePacket(void) bool PacketAPI::sendPacket(void) { - // fill dummy buffer; we don't use it, we directly send the fromRadio structure - uint32_t len = getFromRadio(txBuf); - if (len != 0) { - static uint32_t id = 0; - fromRadioScratch.id = ++id; - bool result = server->sendPacket(DataPacket(id, fromRadioScratch)); - if (!result) { - LOG_ERROR("send queue full"); + if (server->available()) { + // fill dummy buffer; we don't use it, we directly send the fromRadio structure + uint32_t len = getFromRadio(txBuf); + if (len != 0) { + static uint32_t id = 0; + fromRadioScratch.id = ++id; + bool result = server->sendPacket(DataPacket(id, fromRadioScratch)); + if (!result) { + LOG_ERROR("send queue full"); + } + return result; } - return result; - } else - return false; + } + return false; } bool PacketAPI::notifyProgrammingMode(void)