APRS Bridge for TNC

This commit is contained in:
richonguzman 2025-10-15 15:11:07 -03:00
parent 8add599838
commit a618383617
8 changed files with 55 additions and 24 deletions

View file

@ -82,7 +82,8 @@
"tnc": {
"enableServer": false,
"enableSerial": false,
"acceptOwn": false
"acceptOwn": false,
"aprsBrigdeActive": false
},
"mqtt": {
"active": false,

View file

@ -1511,25 +1511,7 @@
</div>
<div class="col-lg-9 col-sm-12">
<div class="row">
<div class="col-12">
<div class="form-check form-switch">
<div class="form-text">
Server will be available at port <strong>8001</strong>
</div>
<input
type="checkbox"
name="tnc.enableServer"
id="tnc.enableServer"
class="form-check-input"
/>
<label
for="tnc.enableServer"
class="form-label"
>Enable TNC server</label
>
</div>
</div>
<div class="col-12">
<div class="col-6">
<div class="form-check form-switch">
<input
type="checkbox"
@ -1544,7 +1526,24 @@
>
</div>
</div>
<div class="col-12">
<div class="col-6">
<div class="form-check form-switch">
<input
type="checkbox"
name="tnc.enableServer"
id="tnc.enableServer"
class="form-check-input"
/>
<label
for="tnc.enableServer"
class="form-label"
>Enable TNC server <small><strong>(Port 8001)</strong></small></label
>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-6">
<div class="form-check form-switch">
<input
type="checkbox"
@ -1559,6 +1558,21 @@
>
</div>
</div>
<div class="col-6">
<div class="form-check form-switch">
<input
type="checkbox"
name="tnc.aprsBridgeActive"
id="tnc.aprsBridgeActive"
class="form-check-input"
/>
<label
for="tnc.aprsBridgeActive"
class="form-label"
>Enable APRS Bridge</label
>
</div>
</div>
</div>
</div>
</div>

View file

@ -206,6 +206,7 @@ function loadSettings(settings) {
document.getElementById("tnc.enableServer").checked = settings.tnc.enableServer;
document.getElementById("tnc.enableSerial").checked = settings.tnc.enableSerial;
document.getElementById("tnc.acceptOwn").checked = settings.tnc.acceptOwn;
document.getElementById("tnc.aprsBridgeActive").checked = settings.tnc.aprsBridgeActive;
}
// MQTT

View file

@ -127,6 +127,7 @@ public:
bool enableServer;
bool enableSerial;
bool acceptOwn;
bool aprsBridgeActive;
};
class OTA {

View file

@ -25,6 +25,7 @@
#include "query_utils.h"
#include "A7670_utils.h"
#include "digi_utils.h"
#include "tnc_utils.h"
#include "display.h"
#include "utils.h"
@ -367,6 +368,10 @@ namespace APRS_IS_Utils {
Serial.println(" ---> Rejected (Time): No Tx");
}
}
if (Config.tnc.aprsBridgeActive) {
if (Config.tnc.enableServer) TNC_Utils::sendToClients(packet); // Send received packet to TNC KISS
if (Config.tnc.enableSerial) TNC_Utils::sendToSerial(packet); // Send received packet to Serial KISS
}
}
}

View file

@ -131,6 +131,7 @@ bool Configuration::writeFile() {
data["tnc"]["enableServer"] = tnc.enableServer;
data["tnc"]["enableSerial"] = tnc.enableSerial;
data["tnc"]["acceptOwn"] = tnc.acceptOwn;
data["tnc"]["aprsBridgeActive"] = tnc.aprsBridgeActive;
data["mqtt"]["active"] = mqtt.active;
data["mqtt"]["server"] = mqtt.server;
@ -331,10 +332,12 @@ bool Configuration::readFile() {
if (!data["tnc"].containsKey("enableServer") ||
!data["tnc"].containsKey("enableSerial") ||
!data["tnc"].containsKey("acceptOwn")) needsRewrite = true;
!data["tnc"].containsKey("acceptOwn") ||
!data["tnc"].containsKey("aprsBridgeActive")) needsRewrite = true;
tnc.enableServer = data["tnc"]["enableServer"] | false;
tnc.enableSerial = data["tnc"]["enableSerial"] | false;
tnc.acceptOwn = data["tnc"]["acceptOwn"] | false;
tnc.aprsBridgeActive = data["tnc"]["aprsBridgeActive"] | false;
if (!data["mqtt"].containsKey("active") ||
!data["mqtt"].containsKey("server") ||
@ -496,6 +499,7 @@ void Configuration::setDefaultValues() {
tnc.enableServer = false;
tnc.enableSerial = false;
tnc.acceptOwn = false;
tnc.aprsBridgeActive = false;
mqtt.active = false;
mqtt.server = "";

View file

@ -21,12 +21,15 @@
#include "configuration.h"
#include "station_utils.h"
#include "kiss_protocol.h"
#include "aprs_is_utils.h"
#include "kiss_utils.h"
#include "tnc_utils.h"
#include "utils.h"
extern Configuration Config;
extern Configuration Config;
extern WiFiClient aprsIsClient;
extern bool passcodeValid;
#define MAX_CLIENTS 4
#define INPUT_BUFFER_SIZE (2 + MAX_CLIENTS)
@ -94,7 +97,8 @@ namespace TNC_Utils {
String sender = frame.substring(0,frame.indexOf(">"));
if (Config.tnc.acceptOwn || sender != Config.callsign) {
STATION_Utils::addToOutputPacketBuffer(frame);
if (Config.loramodule.txActive) STATION_Utils::addToOutputPacketBuffer(frame);
if (Config.tnc.aprsBridgeActive && Config.aprs_is.active && passcodeValid && aprsIsClient.connected()) APRS_IS_Utils::upload(frame);
} else {
Utils::println("Ignored own frame from KISS");
}

View file

@ -259,6 +259,7 @@ namespace WEB_Utils {
Config.tnc.enableServer = request->hasParam("tnc.enableServer", true);
Config.tnc.enableSerial = request->hasParam("tnc.enableSerial", true);
Config.tnc.acceptOwn = request->hasParam("tnc.acceptOwn", true);
Config.tnc.aprsBridgeActive = request->hasParam("tnc.aprsBridgeActive", true);
Config.mqtt.active = request->hasParam("mqtt.active", true);