Compare commits

..
Author SHA1 Message Date
Ricardo Guzman 9db47174f6 update 2026-11-17 13:59:13 -03:00
Ricardo Guzman 8fb5135746 new changes to RP2035 update 2026-11-17 13:55:33 -03:00
Ricardo Guzman 23f042c83d Merge branch 'rp2035-merge' into rp2035-with-IS2 2026-11-17 13:55:17 -03:00
Ricardo Guzman 2b6012a0ca Wifi Fix when returning from backupMode 2026-11-17 13:48:50 -03:00
6 changed files with 45 additions and 10 deletions

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ ___________________________________________________________________*/
#endif
String versionDate = "2026-10-29";
String versionDate = "2026-11-17";
String versionNumber = "4.0.5";
Configuration Config;
WiFiClient aprsIsClient;
+31 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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
}
+1
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}