sforkowany z mirror/meshtastic-firmware
don't assert fail if the txfifo is full, just drop the packet
rodzic
acce254685
commit
ae023a57e8
|
@ -5,8 +5,6 @@
|
|||
#include "assert.h"
|
||||
#include "NodeDB.h"
|
||||
|
||||
#define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission
|
||||
|
||||
/// A temporary buffer used for sending/receving packets, sized to hold the biggest buffer we might need
|
||||
#define MAX_RHPACKETLEN 251
|
||||
static uint8_t radiobuf[MAX_RHPACKETLEN];
|
||||
|
@ -47,7 +45,12 @@ ErrorCode CustomRF95::send(MeshPacket *p)
|
|||
else
|
||||
{
|
||||
DEBUG_MSG("enquing packet for send from=0x%x, to=0x%x\n", p->from, p->to);
|
||||
return txQueue.enqueue(p, 0) ? ERRNO_OK : ERRNO_UNKNOWN; // nowait
|
||||
ErrorCode res = txQueue.enqueue(p, 0) ? ERRNO_OK : ERRNO_UNKNOWN;
|
||||
|
||||
if (res != ERRNO_OK) // we weren't able to queue it, so we must drop it to prevent leaks
|
||||
pool.release(p);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
#include "PointerQueue.h"
|
||||
#include "MeshTypes.h"
|
||||
|
||||
#define MAX_TX_QUEUE 16 // max number of packets which can be waiting for transmission
|
||||
|
||||
|
||||
/**
|
||||
* A version of the RF95 driver which is smart enough to manage packets via queues (no polling or blocking in user threads!)
|
||||
*/
|
||||
|
|
|
@ -49,8 +49,6 @@
|
|||
#error "HW_VERSION not set"
|
||||
#endif
|
||||
|
||||
#define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission
|
||||
|
||||
|
||||
/**
|
||||
* A raw low level interface to our mesh. Only understands nodenums and bytes (not protobufs or node ids)
|
||||
|
|
|
@ -218,7 +218,10 @@ void MeshService::handleToRadio(std::string s)
|
|||
void MeshService::sendToMesh(MeshPacket *p)
|
||||
{
|
||||
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
||||
assert(radio.send(p) == ERRNO_OK);
|
||||
|
||||
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
|
||||
if(radio.send(p) != ERRNO_OK)
|
||||
DEBUG_MSG("Dropped packet because send queue was full!");
|
||||
}
|
||||
|
||||
MeshPacket *MeshService::allocForSending()
|
||||
|
|
Ładowanie…
Reference in New Issue