buffer 0.1

This commit is contained in:
richonguzman 2024-05-13 21:24:44 -04:00
parent 4d4598e09e
commit c5dcfd86b2
3 changed files with 27 additions and 26 deletions

View file

@ -64,8 +64,6 @@ uint32_t lastBatteryCheck = 0;
String batteryVoltage;
std::vector<String> lastHeardStation;
std::vector<String> outputPacketBuffer;
uint32_t lastTxTime = millis();
uint32_t lastRxTime = millis();

View file

@ -159,29 +159,31 @@ namespace APRS_IS_Utils {
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
Sender = packet.substring(3, packet.indexOf(">"));
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
STATION_Utils::updateLastHeard(Sender);
Utils::typeOfPacket(packet.substring(3), "LoRa-APRS");
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
Addressee.trim();
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
queryMessage = processReceivedLoRaMessage(Sender, AddresseeAndMessage);
}
if (!queryMessage) {
aprsPacket = buildPacketToUpload(packet);
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
display_toggle(true);
if (STATION_Utils::check25SegBuffer(Sender, packet.substring(packet.indexOf(":")+2))) {
STATION_Utils::updateLastHeard(Sender);
Utils::typeOfPacket(packet.substring(3), "LoRa-APRS");
AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
Addressee.trim();
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
queryMessage = processReceivedLoRaMessage(Sender, AddresseeAndMessage);
}
if (!queryMessage) {
aprsPacket = buildPacketToUpload(packet);
if (!Config.display.alwaysOn && Config.display.timeout != 0) {
display_toggle(true);
}
lastScreenOn = millis();
#ifdef ESP32_DIY_LoRa_A7670
stationBeacon = true;
A7670_Utils::uploadToAPRSIS(aprsPacket);
stationBeacon = false;
#else
upload(aprsPacket);
#endif
Utils::println("---> Uploaded to APRS-IS");
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
}
lastScreenOn = millis();
#ifdef ESP32_DIY_LoRa_A7670
stationBeacon = true;
A7670_Utils::uploadToAPRSIS(aprsPacket);
stationBeacon = false;
#else
upload(aprsPacket);
#endif
Utils::println("---> Uploaded to APRS-IS");
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
}
}
}

View file

@ -6,12 +6,12 @@
#include <vector>
extern Configuration Config;
extern std::vector<String> lastHeardStation;
extern std::vector<String> outputPacketBuffer;
extern uint32_t lastTxTime;
extern uint32_t lastRxTime;
extern String fourthLine;
std::vector<String> lastHeardStation;
std::vector<String> outputPacketBuffer;
std::vector<String> packet25SegBuffer;
std::vector<uint32_t> packet25SegTimeBuffer;
@ -69,6 +69,7 @@ namespace STATION_Utils {
void clean25SegBuffer() {
if (!packet25SegTimeBuffer.empty()) {
if (millis() - packet25SegTimeBuffer[0] > 25 * 1000) {
Serial.print("Borrando : "); Serial.println(packet25SegBuffer[0]);
packet25SegTimeBuffer.erase(packet25SegTimeBuffer.begin());
packet25SegBuffer.erase(packet25SegBuffer.begin());
}