Update main.cpp
- fixed txQueue.pop() not properly deleting popped packets - do not decode packets, when not using serial output (saves processing time)
This commit is contained in:
parent
585ae45c86
commit
5ce9f2d433
15
src/main.cpp
15
src/main.cpp
|
@ -32,16 +32,6 @@ void loop() {
|
||||||
PacketSent = false;
|
PacketSent = false;
|
||||||
startReceive();
|
startReceive();
|
||||||
}
|
}
|
||||||
// other dio1 event
|
|
||||||
/*
|
|
||||||
if (!(p == NULL)) {
|
|
||||||
// drop packet, if we could not send it in 1 minute
|
|
||||||
if ( (p->packetTime + 60*1000) < millis() ) p = NULL;
|
|
||||||
MSG("[INF] TX aborted, could not send packet in 1 minute\n\r");
|
|
||||||
startReceive();
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PacketReceived) {
|
if (PacketReceived) {
|
||||||
|
@ -68,7 +58,9 @@ void loop() {
|
||||||
// print new packets only not repeated due to HopLim 0
|
// print new packets only not repeated due to HopLim 0
|
||||||
if ((repeatPacket) && (hop_limit==0)) {
|
if ((repeatPacket) && (hop_limit==0)) {
|
||||||
MSG("\n\r");
|
MSG("\n\r");
|
||||||
|
#ifndef SILENT
|
||||||
perhapsDecode(&pck);
|
perhapsDecode(&pck);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (hop_limit == 0) repeatPacket = false;
|
if (hop_limit == 0) repeatPacket = false;
|
||||||
// do not repeat if id is known or hop limit is zero
|
// do not repeat if id is known or hop limit is zero
|
||||||
|
@ -122,7 +114,9 @@ void loop() {
|
||||||
if (perhapsSend(p) ) {
|
if (perhapsSend(p) ) {
|
||||||
// packet successfully sent
|
// packet successfully sent
|
||||||
// try to decode the packet and print it
|
// try to decode the packet and print it
|
||||||
|
#ifndef SILENT
|
||||||
perhapsDecode(p);
|
perhapsDecode(p);
|
||||||
|
#endif
|
||||||
PacketSent = true;
|
PacketSent = true;
|
||||||
p = NULL;
|
p = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -514,6 +508,7 @@ bool PacketQueueClass::pop(void) {
|
||||||
PacketToSend.packetTime = millis(); // start timer. after 1 minute, drop packet
|
PacketToSend.packetTime = millis(); // start timer. after 1 minute, drop packet
|
||||||
PacketToSend.size = Queue[idx].size;
|
PacketToSend.size = Queue[idx].size;
|
||||||
memcpy(PacketToSend.buf, Queue[idx].buf, Queue[idx].size);
|
memcpy(PacketToSend.buf, Queue[idx].buf, Queue[idx].size);
|
||||||
|
Queue[idx].size = 0;
|
||||||
this->Count -= 1;
|
this->Count -= 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue