mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-11-17 19:32:21 +01:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cff8abc248 | ||
|
|
a9cf1a150b | ||
|
|
9db47174f6 | ||
|
|
8fb5135746 | ||
|
|
23f042c83d | ||
|
|
2b6012a0ca | ||
|
|
9aa4062d7b | ||
|
|
12c8e40b3c |
No files matched your search
@@ -22,8 +22,9 @@
|
||||
[data-variant="night"] .btn-save{background:#000;border-color:#000;color:#ff6b6b;}
|
||||
[data-variant="night"] .btn-save:hover{background:#1a0000;color:#ff8a8a;}
|
||||
body{background:var(--msh-bg);color:var(--msh-text);font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;}
|
||||
.app-topbar{background:#b21d1d;border-bottom:1px solid rgba(0,0,0,.25);height:56px;z-index:1030;}
|
||||
.app-topbar{background:#b21d1d;border-bottom:1px solid rgba(0,0,0,.25);min-height:56px;padding-top:.35rem;padding-bottom:.35rem;z-index:1030;}
|
||||
.app-topbar .brand{font-weight:600;color:#fff;font-size:1.1rem;}
|
||||
@media(max-width:575.98px){.app-topbar{flex-wrap:wrap;row-gap:.35rem;}.app-topbar .brand{flex:1 1 100%;font-size:.95rem;line-height:1.25;}}
|
||||
.btn-icon{background:transparent;border:1px solid rgba(255,255,255,.45);color:#fff;display:inline-flex;align-items:center;}
|
||||
.btn-icon:hover{background:rgba(255,255,255,.15);color:#fff;}
|
||||
.btn-save{background:#fff;border:1px solid #fff;color:#b21d1d;font-weight:600;}
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@
|
||||
|
||||
void listenAPRSIS() {
|
||||
if (SerialAT.available()) {
|
||||
String packetAPRSIS = SerialAT.readStringUntil('\r');
|
||||
String packetAPRSIS = SerialAT.readStringUntil('\n'); // modem lines end with "\r\n": reading up to '\r' left the '\n' and the next call stalled for the 1 s stream timeout (same fix as listenAPRSIS in aprs_is_utils.cpp); trim() removes the '\r'
|
||||
packetAPRSIS.trim();
|
||||
if (!packetAPRSIS.startsWith("#") && packetAPRSIS.indexOf("+IPD") == -1 && packetAPRSIS.indexOf("RECV") == -1 && packetAPRSIS.length() > 0) {
|
||||
APRS_IS_Utils::processAPRSISPacket(packetAPRSIS);
|
||||
|
||||
@@ -69,7 +69,7 @@ ___________________________________________________________________*/
|
||||
#endif
|
||||
|
||||
|
||||
String versionDate = "2026-10-29";
|
||||
String versionDate = "2026-11-17";
|
||||
String versionNumber = "4.0.5";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
|
||||
@@ -376,7 +376,10 @@ namespace APRS_IS_Utils {
|
||||
#else
|
||||
if (aprsIsClient.connected()) {
|
||||
if (aprsIsClient.available()) {
|
||||
String aprsisPacket = aprsIsClient.readStringUntil('\r');
|
||||
// APRS-IS lines end with "\r\n". Reading up to '\r' left the '\n' in the buffer, and the next call then waited the stream's default 1 s
|
||||
// for another '\r' before returning, so the main loop (and with it the radio) stalled for a second after every line from the server.
|
||||
// Read up to '\n' instead; trim() below removes the '\r'.
|
||||
String aprsisPacket = aprsIsClient.readStringUntil('\n');
|
||||
aprsisPacket.trim(); // Serial.println(aprsisPacket);
|
||||
processAPRSISPacket(aprsisPacket);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <APRSPacketLib.h>
|
||||
#include "configuration.h"
|
||||
#include "station_rp2350.h"
|
||||
#include "syslog_rp2350.h"
|
||||
|
||||
extern Configuration Config;
|
||||
// Inbox store (eth_web.cpp) — poll() runs in netTask, same task that owns it.
|
||||
@@ -20,6 +21,18 @@ static const uint32_t SILENT_DROP_MS = 60000;
|
||||
// Parse one APRS-IS line; if it's a message addressed to our callsign, record it
|
||||
// in the inbox and ack it (if it carries a {msgid}).
|
||||
static void processAprsisLine(const String &line) {
|
||||
// Login answer: "# logresp CALL verified, server T2XXX" / "... unverified, ...".
|
||||
// Like the ESP32 (APRS_IS_Utils::processAPRSISPacket), a rejected passcode stops APRS-IS
|
||||
// (until the next boot or config save) instead of reconnecting every 10 s and uploading
|
||||
// packets the server ignores. Only an explicit "unverified" blocks: if a server never
|
||||
// answers, behaviour stays as before. "unverified" contains "verified", so test it first.
|
||||
if (line.startsWith("# logresp") && line.indexOf(Config.callsign) >= 0 && line.indexOf("unverified") >= 0) {
|
||||
Serial.println("\n****APRS PASSCODE NOT VALID****\n");
|
||||
Syslog::logTx("*** APRS-IS passcode NOT valid -> APRS-IS stopped ***");
|
||||
aprsClient.stop();
|
||||
Config.aprs_is.active = false; // in memory only: the saved config keeps APRS-IS enabled
|
||||
return;
|
||||
}
|
||||
if (line.length() == 0 || line[0] == '#') return; // server comment / keepalive
|
||||
int gt = line.indexOf('>');
|
||||
int dc = line.indexOf("::");
|
||||
@@ -110,7 +123,22 @@ void send(const String &line) {
|
||||
// Gate rules of APRS_IS_Utils::processLoRaPacket. This build never gates APRS-IS
|
||||
// back to RF (no messagesToRF/objectsToRF), so it is a receive-only iGate and
|
||||
// uses qAO, like the ESP32 with messagesToRF off (buildPacketToUpload).
|
||||
void forward(const String &packet) {
|
||||
// IS2PLAIN metadata line sent right before the gated packet (same as buildIS2Meta()
|
||||
// in the ESP32 aprs_is_utils.cpp). rx_modem=2 is LoRa; the bit rate is derived from
|
||||
// the RX SF/BW/CR, which only change with a config save (= reboot), so it is cached.
|
||||
static String buildIS2Meta(int rssi, float snr) {
|
||||
static String fixedTail;
|
||||
if (fixedTail == "") {
|
||||
// LoRa bit rate = SF * (BW / 2^SF) * 4/CR (CR = denominator: 5..8)
|
||||
uint32_t bitrate = (uint32_t)(Config.loramodule.rxSpreadingFactor
|
||||
* ((float)Config.loramodule.rxSignalBandwidth / (1 << Config.loramodule.rxSpreadingFactor))
|
||||
* (4.0 / Config.loramodule.rxCodingRate4));
|
||||
fixedTail = " rx_modem=2 rx_bitrate=" + String(bitrate) + " rx_frequency=" + String(Config.loramodule.rxFreq);
|
||||
}
|
||||
return "#is2-meta rx_rssi_dbm=" + String(rssi) + " rx_snr_db=" + String(snr, 1) + fixedTail;
|
||||
}
|
||||
|
||||
void forward(const String &packet, int rssi, float snr) {
|
||||
if (!aprsClient.connected()) return;
|
||||
if (packet.length() < 5) return;
|
||||
String body = packet.substring(3); // skip the 3-byte LoRa-APRS header
|
||||
@@ -133,7 +161,8 @@ void forward(const String &packet) {
|
||||
line += ",qAO,";
|
||||
line += Config.callsign;
|
||||
line += APRSPacketLib::checkForStartingBytes(body.substring(colon));
|
||||
aprsClient.print(line + "\r\n");
|
||||
if (Config.aprs_is.is2Metadata) aprsClient.print(buildIS2Meta(rssi, snr) + "\r\n" + line + "\r\n"); // meta line + packet in one write
|
||||
else aprsClient.print(line + "\r\n");
|
||||
Serial.println("[aprsis] up: " + line);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ namespace AprsIs {
|
||||
void poll(); // drain incoming server lines (keepalive); drops a silent connection
|
||||
bool silentFor(uint32_t ms); // no line from the server for `ms` (feeds the backup digi)
|
||||
void send(const String &line); // send a raw APRS-IS line (e.g. beacon)
|
||||
void forward(const String &loraPacket); // RX LoRa packet -> APRS-IS (qAO: receive-only iGate)
|
||||
void forward(const String &loraPacket, int rssi, float snr); // RX LoRa packet -> APRS-IS (qAO: receive-only iGate); rssi/snr feed the IS2 meta line
|
||||
}
|
||||
@@ -112,6 +112,7 @@ bool applyConfigForm(const String &contentType, const String &body) {
|
||||
if (Config.aprs_is.active) {
|
||||
Config.aprs_is.messagesToRF = fHas("aprs_is.messagesToRF");
|
||||
Config.aprs_is.objectsToRF = fHas("aprs_is.objectsToRF");
|
||||
Config.aprs_is.is2Metadata = fHas("aprs_is.is2Metadata");
|
||||
Config.aprs_is.server = getParamStringSafe("aprs_is.server", Config.aprs_is.server);
|
||||
Config.aprs_is.passcode = getParamStringSafe("aprs_is.passcode", Config.aprs_is.passcode);
|
||||
Config.aprs_is.port = getParamIntSafe("aprs_is.port", Config.aprs_is.port);
|
||||
|
||||
+7
-2
@@ -167,7 +167,8 @@ void loraTask(void *) {
|
||||
// it was a query addressed to us — answered over RF, don't gate/digi
|
||||
} else {
|
||||
// gate to APRS-IS (handed to netTask, the W5500 owner)
|
||||
String *p = new String(pkt);
|
||||
// "rssi\tsnr\tframe": the signal stats travel with the frame for the IS2 meta line
|
||||
String *p = new String(String(rssi) + "\t" + String(snr, 1) + "\t" + pkt);
|
||||
if (xQueueSend(rxQueue, &p, 0) != pdTRUE) delete p; // drop if full
|
||||
// digipeat: rewrite WIDEn-N and enqueue for anti-collision TX
|
||||
if (Digi::enabled()) {
|
||||
@@ -293,7 +294,11 @@ void netTask(void *) {
|
||||
// forward any LoRa packets handed over by loraTask
|
||||
String *p;
|
||||
while (xQueueReceive(rxQueue, &p, 0) == pdTRUE) {
|
||||
if (Config.aprs_is.active) AprsIs::forward(*p);
|
||||
if (Config.aprs_is.active) {
|
||||
int t1 = p->indexOf('\t');
|
||||
int t2 = (t1 >= 0) ? p->indexOf('\t', t1 + 1) : -1;
|
||||
if (t2 > t1) AprsIs::forward(p->substring(t2 + 1), p->substring(0, t1).toInt(), p->substring(t1 + 1, t2).toFloat());
|
||||
}
|
||||
delete p;
|
||||
}
|
||||
// store any incoming messages addressed to us (for GET /messages.json)
|
||||
|
||||
+4
-4
@@ -49,12 +49,12 @@ namespace WIFI_Utils {
|
||||
uint32_t currentTime = millis();
|
||||
|
||||
if (backupDigiMode) {
|
||||
if (!networkManager->isWiFiConnected() && ((currentTime - lastBackupDigiTime) >= 15 * 60 * 1000)) {
|
||||
Serial.println("*** Stopping BackUp Digi Mode ***");
|
||||
if (lastServerCheck > lastBackupDigiTime) { // APRS-IS server spoke after entering backup (with or without a WiFi drop)
|
||||
Serial.println("*** APRS-IS Server Back (Stopping Backup Digi Mode) ***");
|
||||
backupDigiMode = false;
|
||||
wifiCounter = 0;
|
||||
} else if (networkManager->isWiFiConnected()) {
|
||||
Serial.println("*** WiFi Reconnect Success (Stopping Backup Digi Mode) ***");
|
||||
} else if (!networkManager->isWiFiConnected() && ((currentTime - lastBackupDigiTime) >= 15 * 60 * 1000)) {
|
||||
Serial.println("*** Stopping BackUp Digi Mode ***"); // no WiFi for 15 min: leave backup to retry WiFi
|
||||
backupDigiMode = false;
|
||||
wifiCounter = 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user