small code cleaning on 25SecBuffer
This commit is contained in:
parent
3d01ea03c0
commit
57f720b0d1
|
|
@ -48,7 +48,7 @@ ___________________________________________________________________*/
|
||||||
#include "A7670_utils.h"
|
#include "A7670_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.11.06";
|
String versionDate = "2024.11.16";
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
#ifdef HAS_GPS
|
#ifdef HAS_GPS
|
||||||
|
|
|
||||||
|
|
@ -72,25 +72,15 @@ namespace STATION_Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean25SegBuffer() {
|
void clean25SegBuffer() {
|
||||||
if (!packet25SegBuffer.empty()) {
|
if (!packet25SegBuffer.empty() && (millis() - packet25SegBuffer[0].receivedTime) > 25 * 1000) packet25SegBuffer.erase(packet25SegBuffer.begin());
|
||||||
if ((millis() - packet25SegBuffer[0].receivedTime) > 25 * 1000) {
|
|
||||||
packet25SegBuffer.erase(packet25SegBuffer.begin());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check25SegBuffer(const String& station, const String& textMessage) {
|
bool check25SegBuffer(const String& station, const String& textMessage) {
|
||||||
bool shouldBeIgnored = false;
|
|
||||||
if (!packet25SegBuffer.empty()) {
|
if (!packet25SegBuffer.empty()) {
|
||||||
for (int i = 0; i < packet25SegBuffer.size(); i++) {
|
for (int i = 0; i < packet25SegBuffer.size(); i++) {
|
||||||
if (packet25SegBuffer[i].station == station && packet25SegBuffer[i].payload == textMessage) {
|
if (packet25SegBuffer[i].station == station && packet25SegBuffer[i].payload == textMessage) return false;
|
||||||
shouldBeIgnored = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (shouldBeIgnored) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
Packet25SegBuffer packet;
|
Packet25SegBuffer packet;
|
||||||
packet.receivedTime = millis();
|
packet.receivedTime = millis();
|
||||||
packet.station = station;
|
packet.station = station;
|
||||||
|
|
@ -98,7 +88,6 @@ namespace STATION_Utils {
|
||||||
packet25SegBuffer.push_back(packet);
|
packet25SegBuffer.push_back(packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void processOutputPacketBuffer() {
|
void processOutputPacketBuffer() {
|
||||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue