mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-07-11 20:31:09 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92572245cd | |||
| 152217e71c | |||
| d334164b6f | |||
| 61409ce683 | |||
| 742a6b6477 | |||
| dd2fce3908 |
@@ -52,7 +52,7 @@ ____________________________________________________
|
|||||||
|
|
||||||
# Timeline (Versions):
|
# Timeline (Versions):
|
||||||
|
|
||||||
- 2025-10-11 User defined NTP server added.
|
- 2025-10-11 User defined NTP server and send beacon over MQTT added.
|
||||||
- 2025-10-10 Changed Wiki into a pdf manual.
|
- 2025-10-10 Changed Wiki into a pdf manual.
|
||||||
- 2025-09-26 Heltec Wireless Bridge support added.
|
- 2025-09-26 Heltec Wireless Bridge support added.
|
||||||
- 2025-09-09 MQTT added (pub+sub), Status defined by Op now and many fixes more.
|
- 2025-09-09 MQTT added (pub+sub), Status defined by Op now and many fixes more.
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
"blacklist": "",
|
"blacklist": "",
|
||||||
"digi": {
|
"digi": {
|
||||||
"mode": 0,
|
"mode": 0,
|
||||||
"ecoMode": 0
|
"ecoMode": 0,
|
||||||
|
"beaconOnRxFreq": false
|
||||||
},
|
},
|
||||||
"lora": {
|
"lora": {
|
||||||
"txFreq": 433775000,
|
"txFreq": 433775000,
|
||||||
@@ -86,7 +87,8 @@
|
|||||||
"topic": "",
|
"topic": "",
|
||||||
"username": "",
|
"username": "",
|
||||||
"password": "",
|
"password": "",
|
||||||
"port": 1883
|
"port": 1883,
|
||||||
|
"beaconOverMqtt": false
|
||||||
},
|
},
|
||||||
"ota": {
|
"ota": {
|
||||||
"username": "",
|
"username": "",
|
||||||
@@ -108,6 +110,7 @@
|
|||||||
"rememberStationTime": 30,
|
"rememberStationTime": 30,
|
||||||
"backupDigiMode": false,
|
"backupDigiMode": false,
|
||||||
"rebootMode": false,
|
"rebootMode": false,
|
||||||
"rebootModeTime": 6
|
"rebootModeTime": 6,
|
||||||
|
"startupDelay": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,6 +344,28 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<label
|
||||||
|
for="startupDelay"
|
||||||
|
class="form-label"
|
||||||
|
>Startup Delay<small>(To Allow Router/Modem to start WiFiAP before connection)</small></label
|
||||||
|
>
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="startupDelay"
|
||||||
|
id="startupDelay"
|
||||||
|
placeholder="0"
|
||||||
|
class="form-control"
|
||||||
|
step="1"
|
||||||
|
min="0"
|
||||||
|
max="5"
|
||||||
|
/>
|
||||||
|
<span class="input-group-text"
|
||||||
|
>minutes</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -716,6 +738,28 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 mt-3">
|
||||||
|
<label
|
||||||
|
for="digi.beaconOnRxFreq"
|
||||||
|
class="form-label"
|
||||||
|
>Digipeater Beacon Frequency
|
||||||
|
<small
|
||||||
|
>(If Rx Freq different from Tx Freq).</small
|
||||||
|
></label
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
class="form-select form-select"
|
||||||
|
name="digi.beaconOnRxFreq"
|
||||||
|
id="digi.beaconOnRxFreq"
|
||||||
|
>
|
||||||
|
<option value="false">
|
||||||
|
Beacon on Tx Freq
|
||||||
|
</option>
|
||||||
|
<option value="true">
|
||||||
|
Beacon on Rx Freq
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1641,6 +1685,21 @@
|
|||||||
Default is <strong>1883</strong>
|
Default is <strong>1883</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 mt-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="mqtt.beaconOverMqtt"
|
||||||
|
id="mqtt.beaconOverMqtt"
|
||||||
|
class="form-check-input"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="mqtt.beaconOverMqtt"
|
||||||
|
class="form-label"
|
||||||
|
>Send iGate Beacon to MQTT</label
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+12
-6
@@ -95,6 +95,7 @@ function loadSettings(settings) {
|
|||||||
networksContainer.appendChild(networkElement);
|
networksContainer.appendChild(networkElement);
|
||||||
networkCount++;
|
networkCount++;
|
||||||
});
|
});
|
||||||
|
document.getElementById("startupDelay").value = settings.startupDelay;
|
||||||
|
|
||||||
// APRS-IS
|
// APRS-IS
|
||||||
document.getElementById("aprs_is.active").checked = settings.aprs_is.active;
|
document.getElementById("aprs_is.active").checked = settings.aprs_is.active;
|
||||||
@@ -134,6 +135,7 @@ function loadSettings(settings) {
|
|||||||
// Digi
|
// Digi
|
||||||
document.getElementById("digi.mode").value = settings.digi.mode;
|
document.getElementById("digi.mode").value = settings.digi.mode;
|
||||||
document.getElementById("digi.ecoMode").value = settings.digi.ecoMode;
|
document.getElementById("digi.ecoMode").value = settings.digi.ecoMode;
|
||||||
|
document.getElementById("digi.beaconOnRxFreq").value = settings.digi.beaconOnRxFreq;
|
||||||
|
|
||||||
// LoRa
|
// LoRa
|
||||||
document.getElementById("lora.txFreq").value = settings.lora.txFreq;
|
document.getElementById("lora.txFreq").value = settings.lora.txFreq;
|
||||||
@@ -207,12 +209,14 @@ function loadSettings(settings) {
|
|||||||
document.getElementById("mqtt.username").value = settings.mqtt.username;
|
document.getElementById("mqtt.username").value = settings.mqtt.username;
|
||||||
document.getElementById("mqtt.password").value = settings.mqtt.password;
|
document.getElementById("mqtt.password").value = settings.mqtt.password;
|
||||||
document.getElementById("mqtt.port").value = settings.mqtt.port;
|
document.getElementById("mqtt.port").value = settings.mqtt.port;
|
||||||
MqttCheckbox.checked = settings.mqtt.active;
|
document.getElementById("mqtt.beaconOverMqtt").value = settings.mqtt.beaconOverMqtt;
|
||||||
MqttServer.disabled = !MqttCheckbox.check;
|
MqttCheckbox.checked = settings.mqtt.active;
|
||||||
MqttTopic.disabled = !MqttCheckbox.check;
|
MqttServer.disabled = !MqttCheckbox.check;
|
||||||
MqttUsername.disabled = !MqttCheckbox.check;
|
MqttTopic.disabled = !MqttCheckbox.check;
|
||||||
MqttPassword.disabled = !MqttCheckbox.check;
|
MqttUsername.disabled = !MqttCheckbox.check;
|
||||||
MqttPort.disabled = !MqttCheckbox.check;
|
MqttPassword.disabled = !MqttCheckbox.check;
|
||||||
|
MqttPort.disabled = !MqttCheckbox.check;
|
||||||
|
MqttBeaconOverMqtt.disabled = !MqttCheckbox.check;
|
||||||
|
|
||||||
// Reboot
|
// Reboot
|
||||||
document.getElementById("other.rebootMode").checked = settings.other.rebootMode;
|
document.getElementById("other.rebootMode").checked = settings.other.rebootMode;
|
||||||
@@ -380,12 +384,14 @@ const MqttTopic = document.querySelector('input[name="mqtt.topic
|
|||||||
const MqttUsername = document.querySelector('input[name="mqtt.username"]');
|
const MqttUsername = document.querySelector('input[name="mqtt.username"]');
|
||||||
const MqttPassword = document.querySelector('input[name="mqtt.password"]');
|
const MqttPassword = document.querySelector('input[name="mqtt.password"]');
|
||||||
const MqttPort = document.querySelector('input[name="mqtt.port"]');
|
const MqttPort = document.querySelector('input[name="mqtt.port"]');
|
||||||
|
const MqttBeaconOverMqtt = document.querySelector('input[name="mqtt.beaconOverMqtt"]');
|
||||||
MqttCheckbox.addEventListener("change", function () {
|
MqttCheckbox.addEventListener("change", function () {
|
||||||
MqttServer.disabled = !this.checked;
|
MqttServer.disabled = !this.checked;
|
||||||
MqttTopic.disabled = !this.checked;
|
MqttTopic.disabled = !this.checked;
|
||||||
MqttUsername.disabled = !this.checked;
|
MqttUsername.disabled = !this.checked;
|
||||||
MqttPassword.disabled = !this.checked;
|
MqttPassword.disabled = !this.checked;
|
||||||
MqttPort.disabled = !this.checked;
|
MqttPort.disabled = !this.checked;
|
||||||
|
MqttBeaconOverMqtt.disabled = !this.checked;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reboot Switches
|
// Reboot Switches
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class DIGI {
|
|||||||
public:
|
public:
|
||||||
int mode;
|
int mode;
|
||||||
int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON)
|
int ecoMode; // 0 = Not Active | 1 = Ultra EcoMode | 2 = Not Active (WiFi OFF, Serial ON)
|
||||||
|
bool beaconOnRxFreq;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LoraModule {
|
class LoraModule {
|
||||||
@@ -158,6 +159,7 @@ public:
|
|||||||
String username;
|
String username;
|
||||||
String password;
|
String password;
|
||||||
int port;
|
int port;
|
||||||
|
bool beaconOverMqtt;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
@@ -167,6 +169,7 @@ public:
|
|||||||
bool backupDigiMode;
|
bool backupDigiMode;
|
||||||
bool rebootMode;
|
bool rebootMode;
|
||||||
int rebootModeTime;
|
int rebootModeTime;
|
||||||
|
int startupDelay;
|
||||||
String personalNote;
|
String personalNote;
|
||||||
String blacklist;
|
String blacklist;
|
||||||
std::vector<WiFi_AP> wifiAPs;
|
std::vector<WiFi_AP> wifiAPs;
|
||||||
|
|||||||
@@ -23,12 +23,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
|
||||||
struct Packet25SegBuffer {
|
|
||||||
uint32_t receivedTime;
|
|
||||||
String station;
|
|
||||||
String payload;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct LastHeardStation {
|
struct LastHeardStation {
|
||||||
uint32_t lastHeardTime;
|
uint32_t lastHeardTime;
|
||||||
String station;
|
String station;
|
||||||
@@ -47,7 +41,7 @@ namespace STATION_Utils {
|
|||||||
bool check25SegBuffer(const String& station, const String& textMessage);
|
bool check25SegBuffer(const String& station, const String& textMessage);
|
||||||
void processOutputPacketBufferUltraEcoMode();
|
void processOutputPacketBufferUltraEcoMode();
|
||||||
void processOutputPacketBuffer();
|
void processOutputPacketBuffer();
|
||||||
void addToOutputPacketBuffer(const String& packet);
|
void addToOutputPacketBuffer(const String& packet, bool flag = false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -35,7 +35,7 @@ namespace Utils {
|
|||||||
void processStatus();
|
void processStatus();
|
||||||
String getLocalIP();
|
String getLocalIP();
|
||||||
void setupDisplay();
|
void setupDisplay();
|
||||||
void activeStations();
|
void showActiveStations();
|
||||||
void checkBeaconInterval();
|
void checkBeaconInterval();
|
||||||
void checkDisplayInterval();
|
void checkDisplayInterval();
|
||||||
void validateFreqs();
|
void validateFreqs();
|
||||||
@@ -46,6 +46,7 @@ namespace Utils {
|
|||||||
void checkRebootTime();
|
void checkRebootTime();
|
||||||
void checkSleepByLowBatteryVoltage(uint8_t mode);
|
void checkSleepByLowBatteryVoltage(uint8_t mode);
|
||||||
bool checkValidCallsign(const String& callsign);
|
bool checkValidCallsign(const String& callsign);
|
||||||
|
void startupDelay();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ ___________________________________________________________________*/
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
String versionDate = "2025-10-11";
|
String versionDate = "2025-10-12";
|
||||||
String versionNumber = "3.1.3";
|
String versionNumber = "3.1.3";
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
WiFiClient aprsIsClient;
|
WiFiClient aprsIsClient;
|
||||||
@@ -97,7 +97,6 @@ bool modemLoggedToAPRSIS = false;
|
|||||||
std::vector<ReceivedPacket> receivedPackets;
|
std::vector<ReceivedPacket> receivedPackets;
|
||||||
|
|
||||||
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine;
|
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine;
|
||||||
//#define STARTUP_DELAY 5 //min
|
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@@ -108,12 +107,7 @@ void setup() {
|
|||||||
Utils::validateFreqs();
|
Utils::validateFreqs();
|
||||||
GPS_Utils::setup();
|
GPS_Utils::setup();
|
||||||
STATION_Utils::loadBlacklistAndManagers();
|
STATION_Utils::loadBlacklistAndManagers();
|
||||||
|
Utils::startupDelay();
|
||||||
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
|
|
||||||
displayShow("", " STARTUP DELAY ...", "", "", 0);
|
|
||||||
delay(STARTUP_DELAY * 60 * 1000);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SLEEP_Utils::setup();
|
SLEEP_Utils::setup();
|
||||||
WIFI_Utils::setup();
|
WIFI_Utils::setup();
|
||||||
NTP_Utils::setup();
|
NTP_Utils::setup();
|
||||||
|
|||||||
+17
-2
@@ -45,6 +45,8 @@ bool Configuration::writeFile() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data["other"]["startupDelay"] = startupDelay;
|
||||||
|
|
||||||
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
data["wifi"]["autoAP"]["password"] = wifiAutoAP.password;
|
||||||
data["wifi"]["autoAP"]["timeout"] = wifiAutoAP.timeout;
|
data["wifi"]["autoAP"]["timeout"] = wifiAutoAP.timeout;
|
||||||
|
|
||||||
@@ -85,6 +87,7 @@ bool Configuration::writeFile() {
|
|||||||
#if defined(HAS_A7670)
|
#if defined(HAS_A7670)
|
||||||
if (digi.ecoMode == 1) data["digi"]["ecoMode"] = 2;
|
if (digi.ecoMode == 1) data["digi"]["ecoMode"] = 2;
|
||||||
#endif
|
#endif
|
||||||
|
data["digi"]["beaconOnRxFreq"] = digi.beaconOnRxFreq;
|
||||||
|
|
||||||
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
data["lora"]["rxFreq"] = loramodule.rxFreq;
|
||||||
data["lora"]["txFreq"] = loramodule.txFreq;
|
data["lora"]["txFreq"] = loramodule.txFreq;
|
||||||
@@ -131,6 +134,7 @@ bool Configuration::writeFile() {
|
|||||||
data["mqtt"]["username"] = mqtt.username;
|
data["mqtt"]["username"] = mqtt.username;
|
||||||
data["mqtt"]["password"] = mqtt.password;
|
data["mqtt"]["password"] = mqtt.password;
|
||||||
data["mqtt"]["port"] = mqtt.port;
|
data["mqtt"]["port"] = mqtt.port;
|
||||||
|
data["mqtt"]["beaconOverMqtt"] = mqtt.beaconOverMqtt;
|
||||||
|
|
||||||
data["ota"]["username"] = ota.username;
|
data["ota"]["username"] = ota.username;
|
||||||
data["ota"]["password"] = ota.password;
|
data["ota"]["password"] = ota.password;
|
||||||
@@ -184,6 +188,9 @@ bool Configuration::readFile() {
|
|||||||
wifiAPs.push_back(wifiap);
|
wifiAPs.push_back(wifiap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data["other"].containsKey("startupDelay")) needsRewrite = true;
|
||||||
|
startupDelay = data["other"]["startupDelay"] | 0;
|
||||||
|
|
||||||
if (!data["wifi"]["autoAP"].containsKey("password") ||
|
if (!data["wifi"]["autoAP"].containsKey("password") ||
|
||||||
!data["wifi"]["autoAP"].containsKey("timeout")) needsRewrite = true;
|
!data["wifi"]["autoAP"].containsKey("timeout")) needsRewrite = true;
|
||||||
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
wifiAutoAP.password = data["wifi"]["autoAP"]["password"] | "1234567890";
|
||||||
@@ -241,10 +248,12 @@ bool Configuration::readFile() {
|
|||||||
blacklist = data["blacklist"] | "station callsign";
|
blacklist = data["blacklist"] | "station callsign";
|
||||||
|
|
||||||
if (!data["digi"].containsKey("mode") ||
|
if (!data["digi"].containsKey("mode") ||
|
||||||
!data["digi"].containsKey("ecoMode")) needsRewrite = true;
|
!data["digi"].containsKey("ecoMode") ||
|
||||||
|
!data["digi"].containsKey("beaconOnRxFreq")) needsRewrite = true;
|
||||||
digi.mode = data["digi"]["mode"] | 0;
|
digi.mode = data["digi"]["mode"] | 0;
|
||||||
digi.ecoMode = data["digi"]["ecoMode"] | 0;
|
digi.ecoMode = data["digi"]["ecoMode"] | 0;
|
||||||
if (digi.ecoMode == 1) shouldSleepStop = false;
|
if (digi.ecoMode == 1) shouldSleepStop = false;
|
||||||
|
digi.beaconOnRxFreq = data["digi"]["beaconOnRxFreq"] | false;
|
||||||
|
|
||||||
#if defined(HAS_A7670)
|
#if defined(HAS_A7670)
|
||||||
if (digi.ecoMode == 1) digi.ecoMode = 2;
|
if (digi.ecoMode == 1) digi.ecoMode = 2;
|
||||||
@@ -323,13 +332,15 @@ bool Configuration::readFile() {
|
|||||||
!data["mqtt"].containsKey("topic") ||
|
!data["mqtt"].containsKey("topic") ||
|
||||||
!data["mqtt"].containsKey("username") ||
|
!data["mqtt"].containsKey("username") ||
|
||||||
!data["mqtt"].containsKey("password") ||
|
!data["mqtt"].containsKey("password") ||
|
||||||
!data["mqtt"].containsKey("port")) needsRewrite = true;
|
!data["mqtt"].containsKey("port") ||
|
||||||
|
!data["mqtt"].containsKey("beaconOverMqtt")) needsRewrite = true;
|
||||||
mqtt.active = data["mqtt"]["active"] | false;
|
mqtt.active = data["mqtt"]["active"] | false;
|
||||||
mqtt.server = data["mqtt"]["server"] | "";
|
mqtt.server = data["mqtt"]["server"] | "";
|
||||||
mqtt.topic = data["mqtt"]["topic"] | "aprs-igate";
|
mqtt.topic = data["mqtt"]["topic"] | "aprs-igate";
|
||||||
mqtt.username = data["mqtt"]["username"] | "";
|
mqtt.username = data["mqtt"]["username"] | "";
|
||||||
mqtt.password = data["mqtt"]["password"] | "";
|
mqtt.password = data["mqtt"]["password"] | "";
|
||||||
mqtt.port = data["mqtt"]["port"] | 1883;
|
mqtt.port = data["mqtt"]["port"] | 1883;
|
||||||
|
mqtt.beaconOverMqtt = data["mqtt"]["beaconOverMqtt"] | false;
|
||||||
|
|
||||||
if (!data["ota"].containsKey("username") ||
|
if (!data["ota"].containsKey("username") ||
|
||||||
!data["ota"].containsKey("password")) needsRewrite = true;
|
!data["ota"].containsKey("password")) needsRewrite = true;
|
||||||
@@ -395,6 +406,8 @@ void Configuration::setDefaultValues() {
|
|||||||
|
|
||||||
wifiAPs.push_back(wifiap);
|
wifiAPs.push_back(wifiap);
|
||||||
|
|
||||||
|
startupDelay = 0;
|
||||||
|
|
||||||
wifiAutoAP.password = "1234567890";
|
wifiAutoAP.password = "1234567890";
|
||||||
wifiAutoAP.timeout = 10;
|
wifiAutoAP.timeout = 10;
|
||||||
|
|
||||||
@@ -430,6 +443,7 @@ void Configuration::setDefaultValues() {
|
|||||||
|
|
||||||
digi.mode = 0;
|
digi.mode = 0;
|
||||||
digi.ecoMode = 0;
|
digi.ecoMode = 0;
|
||||||
|
digi.beaconOnRxFreq = false;
|
||||||
|
|
||||||
loramodule.txFreq = 433775000;
|
loramodule.txFreq = 433775000;
|
||||||
loramodule.rxFreq = 433775000;
|
loramodule.rxFreq = 433775000;
|
||||||
@@ -476,6 +490,7 @@ void Configuration::setDefaultValues() {
|
|||||||
mqtt.username = "";
|
mqtt.username = "";
|
||||||
mqtt.password = "";
|
mqtt.password = "";
|
||||||
mqtt.port = 1883;
|
mqtt.port = 1883;
|
||||||
|
mqtt.beaconOverMqtt = false;
|
||||||
|
|
||||||
ota.username = "";
|
ota.username = "";
|
||||||
ota.password = "";
|
ota.password = "";
|
||||||
|
|||||||
+7
-2
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
extern uint32_t lastRxTime;
|
extern uint32_t lastRxTime;
|
||||||
|
extern bool packetIsBeacon;
|
||||||
|
|
||||||
extern std::vector<ReceivedPacket> receivedPackets;
|
extern std::vector<ReceivedPacket> receivedPackets;
|
||||||
|
|
||||||
@@ -143,7 +144,9 @@ namespace LoRa_Utils {
|
|||||||
if (!Config.loramodule.txActive) return;
|
if (!Config.loramodule.txActive) return;
|
||||||
|
|
||||||
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
|
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
|
||||||
changeFreqTx();
|
if (!packetIsBeacon || (packetIsBeacon && !Config.digi.beaconOnRxFreq)) {
|
||||||
|
changeFreqTx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INTERNAL_LED_PIN
|
#ifdef INTERNAL_LED_PIN
|
||||||
@@ -165,7 +168,9 @@ namespace LoRa_Utils {
|
|||||||
if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, LOW); // disabled in Ultra Eco Mode
|
if (Config.digi.ecoMode != 1) digitalWrite(INTERNAL_LED_PIN, LOW); // disabled in Ultra Eco Mode
|
||||||
#endif
|
#endif
|
||||||
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
|
if (Config.loramodule.txFreq != Config.loramodule.rxFreq) {
|
||||||
changeFreqRx();
|
if (!packetIsBeacon || (packetIsBeacon && !Config.digi.beaconOnRxFreq)) {
|
||||||
|
changeFreqRx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
-8
@@ -33,13 +33,26 @@ extern bool shouldSleepLowVoltage;
|
|||||||
|
|
||||||
uint32_t lastTxTime = millis();
|
uint32_t lastTxTime = millis();
|
||||||
std::vector<LastHeardStation> lastHeardStations;
|
std::vector<LastHeardStation> lastHeardStations;
|
||||||
std::vector<String> outputPacketBuffer;
|
|
||||||
std::vector<Packet25SegBuffer> packet25SegBuffer;
|
|
||||||
std::vector<String> blacklist;
|
std::vector<String> blacklist;
|
||||||
std::vector<String> managers;
|
std::vector<String> managers;
|
||||||
std::vector<LastHeardStation> lastHeardObjects;
|
std::vector<LastHeardStation> lastHeardObjects;
|
||||||
|
|
||||||
|
struct OutputPacketBuffer {
|
||||||
|
String packet;
|
||||||
|
bool isBeacon;
|
||||||
|
};
|
||||||
|
std::vector<OutputPacketBuffer> outputPacketBuffer;
|
||||||
|
|
||||||
|
struct Packet25SegBuffer {
|
||||||
|
uint32_t receivedTime;
|
||||||
|
String station;
|
||||||
|
String payload;
|
||||||
|
};
|
||||||
|
std::vector<Packet25SegBuffer> packet25SegBuffer;
|
||||||
|
|
||||||
|
|
||||||
bool saveNewDigiEcoModeConfig = false;
|
bool saveNewDigiEcoModeConfig = false;
|
||||||
|
bool packetIsBeacon = false;
|
||||||
|
|
||||||
|
|
||||||
namespace STATION_Utils {
|
namespace STATION_Utils {
|
||||||
@@ -138,7 +151,7 @@ namespace STATION_Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stationHeard) lastHeardStations.emplace_back(LastHeardStation{millis(), station});
|
if (!stationHeard) lastHeardStations.emplace_back(LastHeardStation{millis(), station});
|
||||||
Utils::activeStations();
|
Utils::showActiveStations();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasHeard(const String& station) {
|
bool wasHeard(const String& station) {
|
||||||
@@ -171,7 +184,9 @@ namespace STATION_Utils {
|
|||||||
size_t currentIndex = 0;
|
size_t currentIndex = 0;
|
||||||
while (currentIndex < outputPacketBuffer.size()) { // this sends all packets from output buffer
|
while (currentIndex < outputPacketBuffer.size()) { // this sends all packets from output buffer
|
||||||
delay(3000); // and cleans buffer to avoid sending packets with time offset
|
delay(3000); // and cleans buffer to avoid sending packets with time offset
|
||||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[currentIndex]); // next time it wakes up
|
if (outputPacketBuffer[currentIndex].isBeacon) packetIsBeacon = true;
|
||||||
|
LoRa_Utils::sendNewPacket(outputPacketBuffer[currentIndex].packet); // next time it wakes up
|
||||||
|
if (outputPacketBuffer[currentIndex].isBeacon) packetIsBeacon = false;
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
outputPacketBuffer.clear();
|
outputPacketBuffer.clear();
|
||||||
@@ -190,13 +205,17 @@ namespace STATION_Utils {
|
|||||||
uint32_t lastRx = millis() - lastRxTime;
|
uint32_t lastRx = millis() - lastRxTime;
|
||||||
uint32_t lastTx = millis() - lastTxTime;
|
uint32_t lastTx = millis() - lastTxTime;
|
||||||
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
||||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = true;
|
||||||
|
LoRa_Utils::sendNewPacket(outputPacketBuffer[0].packet);
|
||||||
|
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = false;
|
||||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||||
lastTxTime = millis();
|
lastTxTime = millis();
|
||||||
}
|
}
|
||||||
if (shouldSleepLowVoltage) {
|
if (shouldSleepLowVoltage) {
|
||||||
while (outputPacketBuffer.size() > 0) {
|
while (outputPacketBuffer.size() > 0) {
|
||||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = true;
|
||||||
|
LoRa_Utils::sendNewPacket(outputPacketBuffer[0].packet);
|
||||||
|
if (outputPacketBuffer[0].isBeacon) packetIsBeacon = false;
|
||||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||||
delay(4000);
|
delay(4000);
|
||||||
}
|
}
|
||||||
@@ -209,8 +228,12 @@ namespace STATION_Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addToOutputPacketBuffer(const String& packet) {
|
void addToOutputPacketBuffer(const String& packet, bool flag) {
|
||||||
outputPacketBuffer.push_back(packet);
|
OutputPacketBuffer entry;
|
||||||
|
entry.packet = packet;
|
||||||
|
entry.isBeacon = flag;
|
||||||
|
|
||||||
|
outputPacketBuffer.push_back(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+10
-3
@@ -127,7 +127,7 @@ namespace Utils {
|
|||||||
seventhLine = " listening...";
|
seventhLine = " listening...";
|
||||||
}
|
}
|
||||||
|
|
||||||
void activeStations() {
|
void showActiveStations() {
|
||||||
char buffer[30]; // Adjust size as needed
|
char buffer[30]; // Adjust size as needed
|
||||||
sprintf(buffer, "Stations (%dmin) = %2d", Config.rememberStationTime, lastHeardStations.size());
|
sprintf(buffer, "Stations (%dmin) = %2d", Config.rememberStationTime, lastHeardStations.size());
|
||||||
fourthLine = buffer;
|
fourthLine = buffer;
|
||||||
@@ -159,7 +159,7 @@ namespace Utils {
|
|||||||
|
|
||||||
STATION_Utils::deleteNotHeard();
|
STATION_Utils::deleteNotHeard();
|
||||||
|
|
||||||
activeStations();
|
showActiveStations();
|
||||||
|
|
||||||
beaconPacket = iGateBeaconPacket;
|
beaconPacket = iGateBeaconPacket;
|
||||||
secondaryBeaconPacket = iGateLoRaBeaconPacket;
|
secondaryBeaconPacket = iGateLoRaBeaconPacket;
|
||||||
@@ -259,7 +259,7 @@ namespace Utils {
|
|||||||
Utils::println("-- Sending Beacon to RF --");
|
Utils::println("-- Sending Beacon to RF --");
|
||||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING DIGI BEACON", 0);
|
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING DIGI BEACON", 0);
|
||||||
seventhLine = " listening...";
|
seventhLine = " listening...";
|
||||||
STATION_Utils::addToOutputPacketBuffer(secondaryBeaconPacket);
|
STATION_Utils::addToOutputPacketBuffer(secondaryBeaconPacket, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastBeaconTx = millis();
|
lastBeaconTx = millis();
|
||||||
@@ -436,4 +436,11 @@ namespace Utils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startupDelay() {
|
||||||
|
if (Config.startupDelay > 0) {
|
||||||
|
displayShow("", " STARTUP DELAY ...", "", "", 0);
|
||||||
|
delay(Config.startupDelay * 60 * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -157,6 +157,8 @@ namespace WEB_Utils {
|
|||||||
Config.wifiAPs.push_back(wifiap);
|
Config.wifiAPs.push_back(wifiap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Config.startupDelay = getParamIntSafe("startupDelay", Config.startupDelay);
|
||||||
|
|
||||||
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
Config.callsign = getParamStringSafe("callsign", Config.callsign);
|
||||||
|
|
||||||
Config.wifiAutoAP.password = getParamStringSafe("wifi.autoAP.password", Config.wifiAutoAP.password);
|
Config.wifiAutoAP.password = getParamStringSafe("wifi.autoAP.password", Config.wifiAutoAP.password);
|
||||||
@@ -196,6 +198,7 @@ namespace WEB_Utils {
|
|||||||
|
|
||||||
Config.digi.mode = getParamIntSafe("digi.mode", Config.digi.mode);
|
Config.digi.mode = getParamIntSafe("digi.mode", Config.digi.mode);
|
||||||
Config.digi.ecoMode = getParamIntSafe("digi.ecoMode", Config.digi.ecoMode);
|
Config.digi.ecoMode = getParamIntSafe("digi.ecoMode", Config.digi.ecoMode);
|
||||||
|
Config.digi.beaconOnRxFreq = request->hasParam("digi.beaconOnRxFreq", true);
|
||||||
|
|
||||||
Config.loramodule.txFreq = getParamIntSafe("lora.txFreq", Config.loramodule.txFreq);
|
Config.loramodule.txFreq = getParamIntSafe("lora.txFreq", Config.loramodule.txFreq);
|
||||||
Config.loramodule.rxFreq = getParamIntSafe("lora.rxFreq", Config.loramodule.rxFreq);
|
Config.loramodule.rxFreq = getParamIntSafe("lora.rxFreq", Config.loramodule.rxFreq);
|
||||||
@@ -261,6 +264,7 @@ namespace WEB_Utils {
|
|||||||
Config.mqtt.username = getParamStringSafe("mqtt.username", Config.mqtt.username);
|
Config.mqtt.username = getParamStringSafe("mqtt.username", Config.mqtt.username);
|
||||||
Config.mqtt.password = getParamStringSafe("mqtt.password", Config.mqtt.password);
|
Config.mqtt.password = getParamStringSafe("mqtt.password", Config.mqtt.password);
|
||||||
Config.mqtt.port = getParamIntSafe("mqtt.port", Config.mqtt.port);
|
Config.mqtt.port = getParamIntSafe("mqtt.port", Config.mqtt.port);
|
||||||
|
Config.mqtt.beaconOverMqtt = request->hasParam("mqtt.beaconOverMqtt", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user