mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-08-06 08:53:30 +02:00
lastRxTime added to process buffer
This commit is contained in:
@@ -52,6 +52,7 @@ std::vector<String> lastHeardStation;
|
||||
std::vector<String> lastHeardStation_temp;
|
||||
std::vector<String> outputPacketBuffer;
|
||||
uint32_t lastTxTime = millis();
|
||||
uint32_t lastRxTime = millis();
|
||||
|
||||
std::vector<ReceivedPacket> receivedPackets;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ extern String sixthLine;
|
||||
extern String seventhLine;
|
||||
|
||||
extern std::vector<String> outputPacketBuffer;
|
||||
extern uint32_t lastRxTime;
|
||||
|
||||
|
||||
namespace APRS_IS_Utils {
|
||||
@@ -243,6 +244,7 @@ namespace APRS_IS_Utils {
|
||||
String aprsisPacket = espClient.readStringUntil('\r');
|
||||
// Serial.println(aprsisPacket);
|
||||
processAPRSISPacket(aprsisPacket);
|
||||
lastRxTime = millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -7,13 +7,15 @@
|
||||
#include "display.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern Configuration Config;
|
||||
extern Configuration Config;
|
||||
extern uint32_t lastRxTime;
|
||||
|
||||
|
||||
extern std::vector<ReceivedPacket> receivedPackets;
|
||||
|
||||
bool transmissionFlag = true;
|
||||
bool ignorePacket = false;
|
||||
bool operationDone = true;
|
||||
bool transmissionFlag = true;
|
||||
bool ignorePacket = false;
|
||||
bool operationDone = true;
|
||||
|
||||
#ifdef HAS_SX1262
|
||||
SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
||||
@@ -181,6 +183,7 @@ namespace LoRa_Utils {
|
||||
if (Config.syslog.active && WiFi.status() == WL_CONNECTED) {
|
||||
SYSLOG_Utils::log("Rx", loraPacket, rssi, snr, freqError);
|
||||
}
|
||||
lastRxTime = millis();
|
||||
return loraPacket;
|
||||
}
|
||||
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
|
||||
|
||||
@@ -10,6 +10,7 @@ extern std::vector<String> lastHeardStation;
|
||||
extern std::vector<String> lastHeardStation_temp;
|
||||
extern std::vector<String> outputPacketBuffer;
|
||||
extern uint32_t lastTxTime;
|
||||
extern uint32_t lastRxTime;
|
||||
extern String fourthLine;
|
||||
|
||||
|
||||
@@ -63,8 +64,10 @@ namespace STATION_Utils {
|
||||
}
|
||||
|
||||
void processOutputPacketBuffer() {
|
||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||
uint32_t lastRx = millis() - lastRxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
if (outputPacketBuffer.size() == 0 || lastTx < 5 * 1000) { // 5 segs between packet tx ???
|
||||
if (outputPacketBuffer.size() == 0 || lastTx < timeToWait || lastRx < timeToWait) {
|
||||
return;
|
||||
} else {
|
||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
||||
|
||||
Reference in New Issue
Block a user