adding igate plus digi mode
This commit is contained in:
parent
d587246be8
commit
9c98a8e369
|
|
@ -60,6 +60,8 @@ ____________________________________________________
|
|||
____________________________________________________
|
||||
## Timeline (Versions):
|
||||
|
||||
- 2024.01.12 Added iGate Mode to also repeat packets (like a iGate+DigiRepeater) in stationMode 2 and 5.
|
||||
- 2024.01.11 Added iGate Mode to enable APRS-IS and LoRa beacon report at the same time.
|
||||
- 2024.01.05 Added support for Lilygo TTGO T-Beam V1, V1.2, V1 + SX1268, V1.2 + SX1262.
|
||||
- 2024.01.02 Added support for EByte 400M30S 1Watt LoRa module for DIY ESP32 iGate.
|
||||
- 2023.12.27 HELTEC V3 board support added. Thanks Luc ON2ON.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
Configuration Config;
|
||||
WiFiClient espClient;
|
||||
|
||||
String versionDate = "2024.01.11";
|
||||
String versionDate = "2024.01.12";
|
||||
int myWiFiAPIndex = 0;
|
||||
int myWiFiAPSize = Config.wifiAPs.size();
|
||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||
|
|
@ -78,7 +78,7 @@ void loop() {
|
|||
APRS_IS_Utils::connect();
|
||||
}
|
||||
APRS_IS_Utils::loop();
|
||||
} else if (stationMode==3 || stationMode==4 || stationMode==6) { // DigiRepeater (3 RxFreq=TxFreq / 4 RxFreq!=TxFreq)
|
||||
} else if (stationMode==3 || stationMode==4) { // DigiRepeater (3 RxFreq=TxFreq / 4 RxFreq!=TxFreq)
|
||||
DIGI_Utils::loop();
|
||||
} else if (stationMode==5) { // iGate when WiFi and APRS available , DigiRepeater when not (RxFreq=TxFreq)
|
||||
Utils::checkWiFiInterval();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "station_utils.h"
|
||||
#include "query_utils.h"
|
||||
#include "lora_utils.h"
|
||||
#include "digi_utils.h"
|
||||
#include "display.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
|
@ -88,44 +89,49 @@ namespace APRS_IS_Utils {
|
|||
#else
|
||||
Serial.print("Received Lora Packet : " + String(packet));
|
||||
#endif
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
if ((packet.substring(0,3) == "\x3c\xff\x01") && (packet.indexOf("TCPIP") == -1) && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("RFONLY") == -1)) {
|
||||
#ifndef PinPointApp
|
||||
Serial.print(" ---> APRS LoRa Packet!");
|
||||
#endif
|
||||
Sender = packet.substring(3,packet.indexOf(">"));
|
||||
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
|
||||
if (stationMode==2 || stationMode==5) {
|
||||
if (packet.indexOf("::") > 10) { // its a Message!
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
||||
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
if (Addressee == Config.callsign) { // its for me!
|
||||
if (AddresseeAndMessage.indexOf("{")>0) { // ack?
|
||||
ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{")+1);
|
||||
ackMessage.trim();
|
||||
delay(4000);
|
||||
//Serial.println(ackMessage);
|
||||
for(int i = Sender.length(); i < 9; i++) {
|
||||
Sender += ' ';
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", Config.callsign + ">APLRG1,RFONLY,WIDE1-1::" + Sender + ":" + ackMessage);
|
||||
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1, AddresseeAndMessage.indexOf("{"));
|
||||
} else {
|
||||
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1);
|
||||
}
|
||||
if (receivedMessage.indexOf("?") == 0) {
|
||||
queryMessage = true;
|
||||
delay(2000);
|
||||
if (!Config.display.alwaysOn) {
|
||||
display_toggle(true);
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", QUERY_Utils::process(receivedMessage, Sender, "LoRa"));
|
||||
lastScreenOn = millis();
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + Sender, "TYPE --> QUERY", 0);
|
||||
}
|
||||
}
|
||||
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
||||
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));
|
||||
Addressee.trim();
|
||||
|
||||
if (stationMode!=1 && Config.igateRepeatsLoRaPackets && Addressee != Config.callsign) { // if its not for me
|
||||
String digiRepeatedPacket = DIGI_Utils::generateDigiRepeatedPacket(packet.substring(3), Config.callsign);
|
||||
if (digiRepeatedPacket != "X") {
|
||||
delay(500);
|
||||
LoRa_Utils::sendNewPacket("APRS", digiRepeatedPacket);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet.indexOf("::") > 10 && Addressee == Config.callsign) { // its a message for me!
|
||||
if (AddresseeAndMessage.indexOf("{")>0) { // ack?
|
||||
ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{")+1);
|
||||
ackMessage.trim();
|
||||
delay(4000);
|
||||
//Serial.println(ackMessage);
|
||||
for(int i = Sender.length(); i < 9; i++) {
|
||||
Sender += ' ';
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", Config.callsign + ">APLRG1,RFONLY,WIDE1-1::" + Sender + ":" + ackMessage);
|
||||
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1, AddresseeAndMessage.indexOf("{"));
|
||||
} else {
|
||||
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1);
|
||||
}
|
||||
if (receivedMessage.indexOf("?") == 0) {
|
||||
queryMessage = true;
|
||||
delay(2000);
|
||||
if (!Config.display.alwaysOn) {
|
||||
display_toggle(true);
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", QUERY_Utils::process(receivedMessage, Sender, "LoRa"));
|
||||
lastScreenOn = millis();
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, "Callsign = " + Sender, "TYPE --> QUERY", 0);
|
||||
}
|
||||
}
|
||||
if (!queryMessage) {
|
||||
aprsPacket = createPacket(packet);
|
||||
if (!Config.display.alwaysOn) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,34 @@ extern String seventhLine;
|
|||
|
||||
namespace DIGI_Utils {
|
||||
|
||||
String generateDigiRepeatedPacket(String packet, String callsign) {
|
||||
String sender, temp0, tocall, path;
|
||||
sender = packet.substring(0,packet.indexOf(">"));
|
||||
temp0 = packet.substring(packet.indexOf(">")+1,packet.indexOf(":"));
|
||||
if (temp0.indexOf(",") > 2) {
|
||||
tocall = temp0.substring(0,temp0.indexOf(","));
|
||||
path = temp0.substring(temp0.indexOf(",")+1,temp0.indexOf(":"));
|
||||
if (path.indexOf("WIDE1-")>=0) {
|
||||
String hop = path.substring(path.indexOf("WIDE1-")+6, path.indexOf("WIDE1-")+7);
|
||||
if (hop.toInt()>=1 && hop.toInt()<=7) {
|
||||
if (hop.toInt()==1) {
|
||||
path.replace("WIDE1-1", callsign + "*");
|
||||
} else {
|
||||
path.replace("WIDE1-" + hop , callsign + "*,WIDE1-" + String(hop.toInt()-1));
|
||||
}
|
||||
String repeatedPacket = sender + ">" + tocall + "," + path + packet.substring(packet.indexOf(":"));
|
||||
return repeatedPacket;
|
||||
} else {
|
||||
return "X";
|
||||
}
|
||||
} else {
|
||||
return "X";
|
||||
}
|
||||
} else {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
|
||||
void processPacket(String packet) {
|
||||
String loraPacket;
|
||||
if (packet != "") {
|
||||
|
|
@ -35,24 +63,17 @@ namespace DIGI_Utils {
|
|||
STATION_Utils::updateLastHeard(sender);
|
||||
STATION_Utils::updatePacketBuffer(packet);
|
||||
Utils::typeOfPacket(packet, "Digi");
|
||||
if ((stationMode==3 || stationMode==5 || stationMode==6) && (packet.indexOf("WIDE1-1") > 10)) { // ver lo de WIDE para sM=6
|
||||
if (stationMode==6 && ((WiFi.status()==WL_CONNECTED) && espClient.connected())) {
|
||||
espClient.write(APRS_IS_Utils::createPacket(packet).c_str());
|
||||
Serial.print("(Uploaded to APRS-IS)");
|
||||
}
|
||||
if (stationMode==6) {
|
||||
loraPacket = packet.substring(3) + " test sM6";
|
||||
delay(5000);
|
||||
} else {
|
||||
loraPacket = packet.substring(3);
|
||||
if ((stationMode==3 || stationMode==5) && (packet.indexOf("WIDE1-") > 10)) {
|
||||
loraPacket = generateDigiRepeatedPacket(packet.substring(3), Config.callsign);
|
||||
if (loraPacket != "X") {
|
||||
delay(500);
|
||||
Serial.println(loraPacket);
|
||||
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
}
|
||||
loraPacket.replace("WIDE1-1", Config.callsign + "*");
|
||||
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
||||
display_toggle(true);
|
||||
lastScreenOn = millis();
|
||||
} else if (stationMode==4){
|
||||
if (packet.indexOf("WIDE1-1") == -1) {
|
||||
if (packet.indexOf("WIDE1-") == -1) {
|
||||
loraPacket = packet.substring(3,packet.indexOf(":")) + "," + Config.callsign + "*" + packet.substring(packet.indexOf(":"));
|
||||
} else {
|
||||
loraPacket = packet.substring(3,packet.indexOf(",")+1) + Config.callsign + "*" + packet.substring(packet.indexOf(","));
|
||||
|
|
@ -88,21 +109,6 @@ namespace DIGI_Utils {
|
|||
Utils::checkBeaconInterval();
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
processPacket(LoRa_Utils::receivePacket());
|
||||
} else if (stationMode==6) {
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
WIFI_Utils::startWiFi();
|
||||
}
|
||||
if (!espClient.connected()) {
|
||||
APRS_IS_Utils::connect();
|
||||
}
|
||||
String Tx = String(Config.loramodule.digirepeaterTxFreq);
|
||||
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
|
||||
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
|
||||
thirdLine = "<< Digi + iGate >>";
|
||||
Utils::checkDisplayInterval();
|
||||
Utils::checkBeaconInterval();
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
processPacket(LoRa_Utils::receivePacket());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
namespace DIGI_Utils {
|
||||
|
||||
String generateDigiRepeatedPacket(String packet, String callsign);
|
||||
void processPacket(String packet);
|
||||
void loop();
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace GPS_Utils {
|
|||
|
||||
String generateBeacon() {
|
||||
String stationLatitude, stationLongitude, beaconPacket;
|
||||
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED && espClient.connected()) || stationMode==6) {
|
||||
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED && espClient.connected())) {
|
||||
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
|
||||
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
|
||||
beaconPacket = Config.callsign + ">APLRG1,WIDE1-1";
|
||||
|
|
|
|||
|
|
@ -116,12 +116,12 @@ namespace Utils {
|
|||
if (Config.bme.active) {
|
||||
String sensorData = BME_Utils::readDataSensor();
|
||||
beaconPacket = iGateBeaconPacket.substring(0,iGateBeaconPacket.indexOf(":=")+20) + "_" + sensorData + iGateBeaconPacket.substring(iGateBeaconPacket.indexOf(":=")+21) + " + WX";
|
||||
if (Config.igateLoRaBeacon) {
|
||||
if (Config.igateLoRaBeacon && stationMode!=1) {
|
||||
secondaryBeaconPacket = iGateLoRaBeaconPacket + sensorData + Config.iGateComment + " + WX";
|
||||
}
|
||||
} else {
|
||||
beaconPacket = iGateBeaconPacket;
|
||||
if (Config.igateLoRaBeacon) {
|
||||
if (Config.igateLoRaBeacon && stationMode!=1) {
|
||||
secondaryBeaconPacket = iGateLoRaBeaconPacket + Config.iGateComment;
|
||||
}
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ namespace Utils {
|
|||
}
|
||||
seventhLine = " listening...";
|
||||
espClient.write((beaconPacket + "\n").c_str());
|
||||
if (Config.igateLoRaBeacon) {
|
||||
if (Config.igateLoRaBeacon && stationMode==2) {
|
||||
LoRa_Utils::sendNewPacket("APRS", secondaryBeaconPacket);
|
||||
}
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
|
|
@ -202,6 +202,9 @@ namespace Utils {
|
|||
}
|
||||
seventhLine = " listening...";
|
||||
espClient.write((beaconPacket + "\n").c_str());
|
||||
if (Config.igateLoRaBeacon) {
|
||||
LoRa_Utils::sendNewPacket("APRS", secondaryBeaconPacket);
|
||||
}
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
} else {
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
|
||||
|
|
@ -216,32 +219,6 @@ namespace Utils {
|
|||
seventhLine = " listening...";
|
||||
LoRa_Utils::sendNewPacket("APRS", beaconPacket);
|
||||
}
|
||||
} else if (stationMode==6) {
|
||||
/* si hay wifi
|
||||
secondLine muestra wifistatus
|
||||
else
|
||||
secondLine = freq digi*/
|
||||
thirdLine = "<< Digi + iGate >>";
|
||||
fifthLine = "";
|
||||
sixthLine = "";
|
||||
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
|
||||
#if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
#endif
|
||||
if (Config.externalVoltageMeasurement) {
|
||||
sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)";
|
||||
}
|
||||
seventhLine = " listening...";
|
||||
|
||||
if (stationMode==6 && ((WiFi.status()==WL_CONNECTED) && espClient.connected())) {
|
||||
espClient.write((beaconPacket + "\n").c_str());
|
||||
Serial.println("---> Uploaded to APRS-IS");
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", beaconPacket);
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
}
|
||||
lastBeaconTx = millis();
|
||||
lastScreenOn = millis();
|
||||
|
|
|
|||
|
|
@ -25,11 +25,9 @@ namespace WIFI_Utils {
|
|||
|
||||
void startWiFi() {
|
||||
int wifiCounter = 0;
|
||||
if (stationMode!=6) {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
delay(500);
|
||||
}
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
delay(500);
|
||||
unsigned long start = millis();
|
||||
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
|
||||
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
|
||||
|
|
@ -48,7 +46,7 @@ namespace WIFI_Utils {
|
|||
delay(1000);
|
||||
if(myWiFiAPIndex >= (myWiFiAPSize-1)) {
|
||||
myWiFiAPIndex = 0;
|
||||
if (stationMode==5 || stationMode==6) {
|
||||
if (stationMode==5) {
|
||||
wifiCounter++;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -94,10 +92,6 @@ namespace WIFI_Utils {
|
|||
btStop();
|
||||
} else if (stationMode==5) {
|
||||
Serial.println("stationMode ---> iGate when Wifi/APRS available (DigiRepeater when not)");
|
||||
} else if (stationMode==6) {
|
||||
Serial.println("stationMode ---> Digirepeater with iGate capabilities (when WiFi available)");
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
} else {
|
||||
Serial.println("stationMode ---> NOT VALID, check '/data/igate_conf.json'");
|
||||
show_display("------- ERROR -------", "stationMode Not Valid", "change it on : /data/", "igate_conf.json", 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue