mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-28 16:52:33 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95e437cb50 | ||
|
|
9c488991e2 | ||
|
|
ddcd33b94a | ||
|
|
b688391a0e | ||
|
|
56d63d0389 | ||
|
|
ad5a5ccf18 | ||
|
|
92bc0a7667 | ||
|
|
ffcfc42b8a | ||
|
|
f3e0830473 | ||
|
|
62107a5b4a | ||
|
|
9801545965 | ||
|
|
dd89f56436 | ||
|
|
27593d8718 | ||
|
|
008575b422 | ||
|
|
b8eedabe9a | ||
|
|
7371b8e37a | ||
|
|
44605e82c2 | ||
|
|
0360085131 | ||
|
|
57f720b0d1 | ||
|
|
3d01ea03c0 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -77,6 +77,8 @@ jobs:
|
||||
chip: esp32c3
|
||||
- name: QRPLabs_LightGateway_1_0
|
||||
chip: esp32s3
|
||||
- name: XIAO_ESP32S3_WIO_SX1262
|
||||
chip: esp32s3
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
||||
@@ -52,6 +52,9 @@ ____________________________________________________
|
||||
|
||||
## Timeline (Versions):
|
||||
|
||||
- 2025.01.02 Callsign Black List added.
|
||||
- 2024.12.30 Fixed missing validation for correct Digipeater mode when not connected to APRS-IS.
|
||||
- 2024.12.06 APRS-IS connnection and passcode validation added.
|
||||
- 2024.11.06 (Silent Update) Working now with Board "VARIANTS".
|
||||
- 2024.10.29 Added LILYGO Lora32 T3S3 support.
|
||||
- 2024.10.25 Added QRP Labs LightGateway 1.0 support.
|
||||
|
||||
@@ -32,7 +32,7 @@ lib_deps =
|
||||
arduino-libraries/NTPClient @ 3.2.1
|
||||
ayushsharma82/ElegantOTA @ 3.1.5
|
||||
bblanchon/ArduinoJson @ 6.21.3
|
||||
jgromes/RadioLib @ 6.6.0
|
||||
jgromes/RadioLib @ 7.1.0
|
||||
mathieucarbou/AsyncTCP @ 3.2.5
|
||||
mathieucarbou/ESPAsyncWebServer @ 3.2.3
|
||||
mikalhart/TinyGPSPlus @ 1.0.3
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
"externalSleepVoltage": 10.9,
|
||||
"voltageDividerR1": 100.0,
|
||||
"voltageDividerR2": 27.0,
|
||||
"sendVoltageAsTelemetry": true
|
||||
"sendVoltageAsTelemetry": false
|
||||
},
|
||||
"wxsensor": {
|
||||
"active": false,
|
||||
@@ -65,8 +65,8 @@
|
||||
},
|
||||
"syslog": {
|
||||
"active": false,
|
||||
"server": "192.168.0.100",
|
||||
"port": 514
|
||||
"server": "lora.link9.net",
|
||||
"port": 1514
|
||||
},
|
||||
"tnc": {
|
||||
"enableServer": false,
|
||||
@@ -92,5 +92,6 @@
|
||||
"rebootMode": false,
|
||||
"rebootModeTime": 6
|
||||
},
|
||||
"personalNote": ""
|
||||
"personalNote": "",
|
||||
"blackList": ""
|
||||
}
|
||||
@@ -77,7 +77,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<span>List refresh automatically every 15 seconds.</span><br>
|
||||
<small>(Local Time is NPT-Time adjusted with your GMT Offset)</small>
|
||||
<small>(Local Time is NTP-Time adjusted with your GMT Offset)</small>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
@@ -573,6 +573,47 @@
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
<h5>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
fill="currentColor"
|
||||
class="bi bi-broadcast-pin"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path
|
||||
d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8"
|
||||
/>
|
||||
</svg>
|
||||
Black List
|
||||
</h5>
|
||||
<small>Add Callsigns with space between them to Black List them (* wild card allowed)</small>
|
||||
</div>
|
||||
<div class="col-9 mt-2">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label
|
||||
for="blackList"
|
||||
class="form-label"
|
||||
>Black List</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="blackList"
|
||||
id="blackList"
|
||||
class="form-control"
|
||||
placeholder="Station Callsign"
|
||||
oninput="this.value = this.value.toUpperCase();"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div class="row my-5 d-flex align-items-top">
|
||||
<div class="col-lg-3 col-sm-12">
|
||||
<h5>
|
||||
@@ -1310,7 +1351,7 @@
|
||||
type="text"
|
||||
name="syslog.port"
|
||||
id="syslog.port"
|
||||
placeholder="514"
|
||||
placeholder="1514"
|
||||
class="form-control"
|
||||
disabled
|
||||
/>
|
||||
|
||||
@@ -137,6 +137,9 @@ function loadSettings(settings) {
|
||||
document.getElementById("beacon.gpsActive").checked = settings.beacon.gpsActive;
|
||||
document.getElementById("beacon.gpsAmbiguity").checked = settings.beacon.gpsAmbiguity;
|
||||
|
||||
// Black List
|
||||
document.getElementById("blackList").value = settings.blackList;
|
||||
|
||||
// Digi
|
||||
document.getElementById("digi.mode").value = settings.digi.mode;
|
||||
document.getElementById("digi.ecoMode").checked = settings.digi.ecoMode;
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
@@ -8,6 +8,7 @@ namespace APRS_IS_Utils {
|
||||
|
||||
void upload(const String& line);
|
||||
void connect();
|
||||
|
||||
void checkStatus();
|
||||
String checkForStartingBytes(const String& packet);
|
||||
|
||||
@@ -19,6 +20,8 @@ namespace APRS_IS_Utils {
|
||||
void processAPRSISPacket(const String& packet);
|
||||
void listenAPRSIS();
|
||||
|
||||
void firstConnection();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
bool ecoMode;
|
||||
};
|
||||
|
||||
|
||||
class LoraModule {
|
||||
public:
|
||||
long txFreq;
|
||||
@@ -135,6 +134,7 @@ public:
|
||||
bool rebootMode;
|
||||
int rebootModeTime;
|
||||
String personalNote;
|
||||
String blackList;
|
||||
std::vector<WiFi_AP> wifiAPs;
|
||||
WiFi_Auto_AP wifiAutoAP;
|
||||
BEACON beacon;
|
||||
@@ -18,6 +18,8 @@ struct LastHeardStation {
|
||||
|
||||
namespace STATION_Utils {
|
||||
|
||||
void loadBlackList();
|
||||
bool checkBlackList(const String& callsign);
|
||||
void deleteNotHeard();
|
||||
void updateLastHeard(const String& station);
|
||||
bool wasHeard(const String& station);
|
||||
@@ -48,7 +48,7 @@ ___________________________________________________________________*/
|
||||
#include "A7670_utils.h"
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.11.06";
|
||||
String versionDate = "2025.01.02";
|
||||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
#ifdef HAS_GPS
|
||||
@@ -79,6 +79,7 @@ void setup() {
|
||||
LoRa_Utils::setup();
|
||||
Utils::validateFreqs();
|
||||
GPS_Utils::setup();
|
||||
STATION_Utils::loadBlackList();
|
||||
|
||||
#ifdef STARTUP_DELAY // (TEST) just to wait for WiFi init of Routers
|
||||
displayShow("", " STARTUP DELAY ...", "", "", 0);
|
||||
@@ -136,6 +137,7 @@ void setup() {
|
||||
A7670_Utils::setup();
|
||||
#endif
|
||||
Utils::checkRebootMode();
|
||||
APRS_IS_Utils::firstConnection();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -149,14 +151,13 @@ void loop() {
|
||||
if (Config.lowVoltageCutOff > 0) {
|
||||
BATTERY_Utils::checkIfShouldSleep();
|
||||
}
|
||||
|
||||
|
||||
thirdLine = Utils::getLocalIP();
|
||||
|
||||
WIFI_Utils::checkWiFi();
|
||||
|
||||
#ifdef HAS_A7670
|
||||
if (Config.aprs_is.active && !modemLoggedToAPRSIS) A7670_Utils::APRS_IS_connect();
|
||||
#else
|
||||
WIFI_Utils::checkWiFi();
|
||||
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) APRS_IS_Utils::connect();
|
||||
#endif
|
||||
|
||||
@@ -191,10 +192,10 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.aprs_is.active) { // If APRSIS enabled
|
||||
if (Config.aprs_is.active) {
|
||||
APRS_IS_Utils::listenAPRSIS(); // listen received packet from APRSIS
|
||||
}
|
||||
|
||||
|
||||
STATION_Utils::processOutputPacketBuffer();
|
||||
|
||||
displayShow(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
|
||||
@@ -22,7 +22,8 @@ extern String seventhLine;
|
||||
extern bool modemLoggedToAPRSIS;
|
||||
extern bool backUpDigiMode;
|
||||
|
||||
uint32_t lastRxTime = millis();
|
||||
uint32_t lastRxTime = millis();
|
||||
bool passcodeValid = false;
|
||||
|
||||
#ifdef HAS_A7670
|
||||
extern bool stationBeacon;
|
||||
@@ -50,11 +51,9 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
if (count == 20) {
|
||||
Serial.println("Tried: " + String(count) + " FAILED!");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Serial.println("Connected!\n(Server: " + String(Config.aprs_is.server) + " / Port: " + String(Config.aprs_is.port) + ")");
|
||||
// String filter = "t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance;
|
||||
|
||||
String aprsAuth = "user ";
|
||||
aprsAuth += Config.callsign;
|
||||
aprsAuth += " pass ";
|
||||
@@ -62,7 +61,6 @@ namespace APRS_IS_Utils {
|
||||
aprsAuth += " vers CA2RXU_LoRa_iGate 2.0 filter ";
|
||||
aprsAuth += Config.aprs_is.filter;
|
||||
upload(aprsAuth);
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,13 +172,13 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
|
||||
void processLoRaPacket(const String& packet) {
|
||||
if (espClient.connected() || modemLoggedToAPRSIS) {
|
||||
if (passcodeValid && (espClient.connected() || modemLoggedToAPRSIS)) {
|
||||
if (packet != "") {
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
int firstColonIndex = packet.indexOf(":");
|
||||
if (firstColonIndex > 5 && firstColonIndex < (packet.length() - 1) && packet[firstColonIndex + 1] != '}' && packet.indexOf("TCPIP") == -1) {
|
||||
const String& Sender = packet.substring(3, packet.indexOf(">"));
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender)) {
|
||||
if (Sender != Config.callsign && Utils::checkValidCallsign(Sender) && !STATION_Utils::checkBlackList(Sender)) {
|
||||
STATION_Utils::updateLastHeard(Sender);
|
||||
Utils::typeOfPacket(packet.substring(3), 0); // LoRa-APRS
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
@@ -259,13 +257,22 @@ namespace APRS_IS_Utils {
|
||||
}
|
||||
|
||||
void processAPRSISPacket(const String& packet) {
|
||||
if (!packet.startsWith("#")) {
|
||||
if (!passcodeValid && packet.indexOf(Config.callsign) != -1) {
|
||||
if (packet.indexOf("unverified") != -1 ) {
|
||||
Serial.println("\n****APRS PASSCODE NOT VALID****\n");
|
||||
displayShow(firstLine, "", " APRS PASSCODE", " NOT VALID !!!", "", "", "", 0);
|
||||
while (1) {};
|
||||
} else if (packet.indexOf("verified") != -1 ) {
|
||||
passcodeValid = true;
|
||||
}
|
||||
}
|
||||
if (passcodeValid && !packet.startsWith("#")) {
|
||||
if (Config.aprs_is.messagesToRF && packet.indexOf("::") > 0) {
|
||||
String Sender = packet.substring(0, packet.indexOf(">"));
|
||||
const String& AddresseeAndMessage = packet.substring(packet.indexOf("::") + 2);
|
||||
String Addressee = AddresseeAndMessage.substring(0, AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // its for me!
|
||||
if (Addressee == Config.callsign) { // its for me!
|
||||
String receivedMessage;
|
||||
if (AddresseeAndMessage.indexOf("{") > 0) { // ack?
|
||||
String ackMessage = "ack";
|
||||
@@ -350,4 +357,13 @@ namespace APRS_IS_Utils {
|
||||
#endif
|
||||
}
|
||||
|
||||
void firstConnection() {
|
||||
if (Config.aprs_is.active && (WiFi.status() == WL_CONNECTED) && !espClient.connected()) {
|
||||
connect();
|
||||
while (!passcodeValid) {
|
||||
listenAPRSIS();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,6 +99,8 @@ void Configuration::writeFile() {
|
||||
|
||||
data["personalNote"] = personalNote;
|
||||
|
||||
data["blackList"] = blackList;
|
||||
|
||||
data["webadmin"]["active"] = webadmin.active;
|
||||
data["webadmin"]["username"] = webadmin.username;
|
||||
data["webadmin"]["password"] = webadmin.password;
|
||||
@@ -196,7 +198,7 @@ bool Configuration::readFile() {
|
||||
|
||||
syslog.active = data["syslog"]["active"] | false;
|
||||
syslog.server = data["syslog"]["server"] | "lora.link9.net";
|
||||
syslog.port = data["syslog"]["port"] | 514;
|
||||
syslog.port = data["syslog"]["port"] | 1514;
|
||||
|
||||
tnc.enableServer = data["tnc"]["enableServer"] | false;
|
||||
tnc.enableSerial = data["tnc"]["enableSerial"] | false;
|
||||
@@ -219,7 +221,9 @@ bool Configuration::readFile() {
|
||||
rebootMode = data["other"]["rebootMode"] | false;
|
||||
rebootModeTime = data["other"]["rebootModeTime"] | 6;
|
||||
|
||||
personalNote = data["personalNote"] | "personal note here...";
|
||||
personalNote = data["personalNote"] | "personal note here";
|
||||
|
||||
blackList = data["blackList"] | "station callsign";
|
||||
|
||||
if (wifiAPs.size() == 0) { // If we don't have any WiFi's from config we need to add "empty" SSID for AUTO AP
|
||||
WiFi_AP wifiap;
|
||||
@@ -293,7 +297,7 @@ void Configuration::init() {
|
||||
|
||||
syslog.active = false;
|
||||
syslog.server = "lora.link9.net";
|
||||
syslog.port = 514;
|
||||
syslog.port = 1514;
|
||||
|
||||
wxsensor.active = false;
|
||||
wxsensor.heightCorrection = 0;
|
||||
@@ -327,6 +331,8 @@ void Configuration::init() {
|
||||
|
||||
personalNote = "";
|
||||
|
||||
blackList = "";
|
||||
|
||||
webadmin.active = false;
|
||||
webadmin.username = "admin";
|
||||
webadmin.password = "";
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace DIGI_Utils {
|
||||
temp = packet.substring(3);
|
||||
Sender = packet.substring(3, packet.indexOf(">"));
|
||||
}
|
||||
if (Sender != Config.callsign) { // Avoid listening to own packets
|
||||
if (Sender != Config.callsign && !STATION_Utils::checkBlackList(Sender)) { // Avoid listening to own packets
|
||||
if (!thirdPartyPacket && !Utils::checkValidCallsign(Sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
#else
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#if defined(HELTEC_V3) || defined(HELTEC_WS)
|
||||
#define OLED_DISPLAY_HAS_RST_PIN
|
||||
#endif
|
||||
#ifdef HELTEC_WSL_V3_DISPLAY
|
||||
Adafruit_SSD1306 display(128, 64, &Wire1, OLED_RST);
|
||||
#else
|
||||
|
||||
@@ -197,7 +197,8 @@ namespace GPS_Utils {
|
||||
encodedBytePosition = packet.indexOf(":=") + 14;
|
||||
}
|
||||
if (encodedBytePosition != 0) {
|
||||
if (String(packet[encodedBytePosition]) == "G" || String(packet[encodedBytePosition]) == "Q" || String(packet[encodedBytePosition]) == "[" || String(packet[encodedBytePosition]) == "H") {
|
||||
char currentChar = packet[encodedBytePosition];
|
||||
if (currentChar == 'G' || currentChar == 'Q' || currentChar == '[' || currentChar == 'H' || currentChar == 'X') {
|
||||
return decodeEncodedGPS(packet);
|
||||
} else {
|
||||
return getReceivedGPS(packet);
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace POWER_Utils {
|
||||
Wire1.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);
|
||||
#endif
|
||||
|
||||
#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(LIGHTGATEWAY_1_0) || defined(TTGO_LORA32_T3S3_V1_2)
|
||||
#if defined(HELTEC_V3) || defined(HELTEC_WS) || defined(LIGHTGATEWAY_1_0) || defined(TTGO_LORA32_T3S3_V1_2) || defined(HELTEC_V2)
|
||||
Wire.begin(OLED_SDA, OLED_SCL);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "configuration.h"
|
||||
#include "battery_utils.h"
|
||||
#include "station_utils.h"
|
||||
#include "query_utils.h"
|
||||
#include "lora_utils.h"
|
||||
@@ -10,6 +11,8 @@ extern String versionDate;
|
||||
extern int rssi;
|
||||
extern float snr;
|
||||
extern int freqError;
|
||||
extern bool shouldSleepLowVoltage;
|
||||
extern bool saveNewDigiEcoModeConfig;
|
||||
|
||||
|
||||
namespace QUERY_Utils {
|
||||
@@ -53,12 +56,16 @@ namespace QUERY_Utils {
|
||||
answer.concat("?WHERE on development 73!");
|
||||
} else if (queryQuestion.indexOf("?APRSEEM") == 0 && Config.digi.ecoMode == true) { // Exit Digipeater EcoMode
|
||||
answer = "DigiEcoMode:Stop";
|
||||
Config.digi.ecoMode = false;
|
||||
Config.display.alwaysOn = true;
|
||||
Config.display.timeout = 10;
|
||||
Config.digi.ecoMode = false;
|
||||
Config.display.alwaysOn = true;
|
||||
Config.display.timeout = 10;
|
||||
shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart.
|
||||
saveNewDigiEcoModeConfig = true;
|
||||
} else if (queryQuestion.indexOf("?APRSSEM") == 0 && Config.digi.ecoMode == false) { // Start Digipeater EcoMode
|
||||
answer = "DigiEcoMode:Start";
|
||||
Config.digi.ecoMode = true;
|
||||
Config.digi.ecoMode = true;
|
||||
shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart.
|
||||
saveNewDigiEcoModeConfig = true;
|
||||
} else if (queryQuestion.indexOf("?APRSEMS") == 0) { // Digipeater EcoMode Status
|
||||
answer = (Config.digi.ecoMode) ? "DigiEcoMode:ON" : "DigiEcoMode:OFF";
|
||||
}
|
||||
|
||||
@@ -16,10 +16,41 @@ uint32_t lastTxTime = millis();
|
||||
std::vector<LastHeardStation> lastHeardStations;
|
||||
std::vector<String> outputPacketBuffer;
|
||||
std::vector<Packet25SegBuffer> packet25SegBuffer;
|
||||
std::vector<String> blackList;
|
||||
|
||||
bool saveNewDigiEcoModeConfig = false;
|
||||
|
||||
|
||||
namespace STATION_Utils {
|
||||
|
||||
void loadBlackList() {
|
||||
if (Config.blackList != "") {
|
||||
String callsigns = Config.blackList;
|
||||
int spaceIndex = callsigns.indexOf(" ");
|
||||
|
||||
while (spaceIndex >= 0) {
|
||||
blackList.push_back(callsigns.substring(0, spaceIndex));
|
||||
callsigns = callsigns.substring(spaceIndex + 1);
|
||||
spaceIndex = callsigns.indexOf(" ");
|
||||
}
|
||||
callsigns.trim();
|
||||
if (callsigns.length() > 0) blackList.push_back(callsigns); // Add the last word if available
|
||||
}
|
||||
}
|
||||
|
||||
bool checkBlackList(const String& callsign) {
|
||||
for (int i = 0; i < blackList.size(); i++) {
|
||||
if (blackList[i].indexOf("*") >= 0) { // use wild card
|
||||
String wildCard = blackList[i].substring(0, blackList[i].indexOf("*"));
|
||||
if (callsign.startsWith(wildCard))return true;
|
||||
} else {
|
||||
if (blackList[i] == callsign) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void deleteNotHeard() {
|
||||
std::vector<LastHeardStation> lastHeardStation_temp;
|
||||
for (int i = 0; i < lastHeardStations.size(); i++) {
|
||||
@@ -72,45 +103,29 @@ namespace STATION_Utils {
|
||||
}
|
||||
|
||||
void clean25SegBuffer() {
|
||||
if (!packet25SegBuffer.empty()) {
|
||||
if ((millis() - packet25SegBuffer[0].receivedTime) > 25 * 1000) {
|
||||
packet25SegBuffer.erase(packet25SegBuffer.begin());
|
||||
}
|
||||
}
|
||||
if (!packet25SegBuffer.empty() && (millis() - packet25SegBuffer[0].receivedTime) > 25 * 1000) packet25SegBuffer.erase(packet25SegBuffer.begin());
|
||||
}
|
||||
|
||||
bool check25SegBuffer(const String& station, const String& textMessage) {
|
||||
bool shouldBeIgnored = false;
|
||||
if (!packet25SegBuffer.empty()) {
|
||||
for (int i = 0; i < packet25SegBuffer.size(); i++) {
|
||||
if (packet25SegBuffer[i].station == station && packet25SegBuffer[i].payload == textMessage) {
|
||||
shouldBeIgnored = true;
|
||||
}
|
||||
if (packet25SegBuffer[i].station == station && packet25SegBuffer[i].payload == textMessage) return false;
|
||||
}
|
||||
}
|
||||
if (shouldBeIgnored) {
|
||||
return false;
|
||||
} else {
|
||||
Packet25SegBuffer packet;
|
||||
packet.receivedTime = millis();
|
||||
packet.station = station;
|
||||
packet.payload = textMessage;
|
||||
packet25SegBuffer.push_back(packet);
|
||||
return true;
|
||||
}
|
||||
Packet25SegBuffer packet;
|
||||
packet.receivedTime = millis();
|
||||
packet.station = station;
|
||||
packet.payload = textMessage;
|
||||
packet25SegBuffer.push_back(packet);
|
||||
return true;
|
||||
}
|
||||
|
||||
void processOutputPacketBuffer() {
|
||||
int timeToWait = 3 * 1000; // 3 segs between packet Tx and also Rx ???
|
||||
uint32_t lastRx = millis() - lastRxTime;
|
||||
uint32_t lastTx = millis() - lastTxTime;
|
||||
bool saveNewDigiEcoModeConfig = false;
|
||||
if (outputPacketBuffer.size() > 0 && lastTx > timeToWait && lastRx > timeToWait) {
|
||||
LoRa_Utils::sendNewPacket(outputPacketBuffer[0]);
|
||||
if (outputPacketBuffer[0].indexOf("DigiEcoMode:Start") != -1 || outputPacketBuffer[0].indexOf("DigiEcoMode:Stop") != -1) {
|
||||
saveNewDigiEcoModeConfig = true;
|
||||
shouldSleepLowVoltage = true; // to make sure all packets in outputPacketBuffer are sended before restart.
|
||||
}
|
||||
outputPacketBuffer.erase(outputPacketBuffer.begin());
|
||||
lastTxTime = millis();
|
||||
}
|
||||
@@ -122,7 +137,9 @@ namespace STATION_Utils {
|
||||
}
|
||||
}
|
||||
if (saveNewDigiEcoModeConfig) {
|
||||
setCpuFrequencyMhz(80);
|
||||
Config.writeFile();
|
||||
delay(1000);
|
||||
displayToggle(false);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
@@ -37,12 +37,13 @@ extern int wxModuleType;
|
||||
extern bool backUpDigiMode;
|
||||
extern bool shouldSleepLowVoltage;
|
||||
extern bool transmitFlag;
|
||||
extern bool passcodeValid;
|
||||
|
||||
extern std::vector<LastHeardStation> lastHeardStations;
|
||||
|
||||
bool statusAfterBoot = true;
|
||||
bool sendStartTelemetry = true;
|
||||
bool beaconUpdate = true;
|
||||
bool beaconUpdate = false;
|
||||
uint32_t lastBeaconTx = 0;
|
||||
uint32_t lastScreenOn = millis();
|
||||
String beaconPacket;
|
||||
@@ -185,7 +186,7 @@ namespace Utils {
|
||||
|
||||
void checkBeaconInterval() {
|
||||
uint32_t lastTx = millis() - lastBeaconTx;
|
||||
if (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000) {
|
||||
if (((Config.aprs_is.active && passcodeValid) || Config.digi.mode != 0) && (lastBeaconTx == 0 || lastTx >= Config.beacon.interval * 60 * 1000)) {
|
||||
beaconUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,8 @@ namespace WEB_Utils {
|
||||
|
||||
Config.personalNote = request->getParam("personalNote", true)->value();
|
||||
|
||||
Config.blackList = request->getParam("blackList", true)->value();
|
||||
|
||||
Config.webadmin.active = request->hasParam("webadmin.active", true);
|
||||
if (Config.webadmin.active) {
|
||||
Config.webadmin.username = request->getParam("webadmin.username", true)->value();
|
||||
|
||||
11
test/README
11
test/README
@@ -1,11 +0,0 @@
|
||||
|
||||
This directory is intended for PlatformIO Test Runner and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||
20
variants/XIAO_ESP32S3_WIO_SX1262/board_pinout.h
Normal file
20
variants/XIAO_ESP32S3_WIO_SX1262/board_pinout.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef BOARD_PINOUT_H_
|
||||
#define BOARD_PINOUT_H_
|
||||
|
||||
// LoRa Radio
|
||||
#define HAS_SX1262
|
||||
#define RADIO_SCLK_PIN 7
|
||||
#define RADIO_MISO_PIN 8
|
||||
#define RADIO_MOSI_PIN 9
|
||||
#define RADIO_CS_PIN 41
|
||||
#define RADIO_RST_PIN 42
|
||||
#define RADIO_DIO1_PIN 39
|
||||
#define RADIO_BUSY_PIN 40
|
||||
|
||||
#define RADIO_HAS_RF_SWITCH // DIO02
|
||||
#define RADIO_RF_SWITCH 38
|
||||
|
||||
#define BUTTON_PIN 21
|
||||
#define INTERNAL_LED_PIN 48
|
||||
|
||||
#endif
|
||||
8
variants/XIAO_ESP32S3_WIO_SX1262/platformio.ini
Normal file
8
variants/XIAO_ESP32S3_WIO_SX1262/platformio.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
[env:XIAO_ESP32S3_WIO_SX1262]
|
||||
board = seeed_xiao_esp32s3
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
${common.usb_flags}
|
||||
-D XIAO_ESP32S3_LORA
|
||||
lib_deps =
|
||||
${common.lib_deps}
|
||||
@@ -20,6 +20,7 @@
|
||||
#define OLED_SDA 4
|
||||
#define OLED_SCL 15
|
||||
#define OLED_RST 16
|
||||
#define OLED_DISPLAY_HAS_RST_PIN
|
||||
|
||||
// Aditional Config
|
||||
#define INTERNAL_LED_PIN 25
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OLED_SDA 17
|
||||
#define OLED_SCL 18
|
||||
#define OLED_RST 21
|
||||
#define OLED_DISPLAY_HAS_RST_PIN
|
||||
|
||||
// Aditional Config
|
||||
#define INTERNAL_LED_PIN 35
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OLED_SDA 4
|
||||
#define OLED_SCL 15
|
||||
#define OLED_RST 16
|
||||
#define OLED_DISPLAY_HAS_RST_PIN
|
||||
|
||||
// Aditional Config
|
||||
#define INTERNAL_LED_PIN 35
|
||||
|
||||
Reference in New Issue
Block a user