update to json config
This commit is contained in:
parent
c81a04a315
commit
e7806a3c05
|
|
@ -1,35 +1,36 @@
|
|||
{
|
||||
"callsign": "CD2RXU-10",
|
||||
"stationMode": 4,
|
||||
"stationMode": 2,
|
||||
"iGateComment": "LoRa_APRS_iGate",
|
||||
"digirepeaterComment": "LoRa_APRS_Digirepeater" ,
|
||||
"wifi": {
|
||||
"AP": [
|
||||
{ "SSID": "Richon",
|
||||
"Password": "k4fPnmg5qnyf",
|
||||
"Latitude": -33.0338131,
|
||||
"Longitude": -71.5737237
|
||||
{ "ssid": "Richon",
|
||||
"password": "k4fPnmg5qnyf",
|
||||
"latitude": -33.0338131,
|
||||
"longitude": -71.5737237
|
||||
},
|
||||
{ "SSID": "Jimenita",
|
||||
"Password": "mg6wyMhqRnxk",
|
||||
"Latitude": -33.0312492,
|
||||
"Longitude": -71.5796215
|
||||
{ "ssid": "Jimenita",
|
||||
"password": "mg6wyMhqRnxk",
|
||||
"latitude": -33.0312492,
|
||||
"longitude": -71.5796215
|
||||
}
|
||||
],
|
||||
"checkInterval": 30
|
||||
]
|
||||
},
|
||||
"digi": {
|
||||
"comment": "LoRa_APRS_Digirepeater",
|
||||
"latitude": -33.0338131,
|
||||
"longitude": -71.5737237
|
||||
},
|
||||
"aprs_is": {
|
||||
"passcode": "23201",
|
||||
"server": "soam.aprs2.net",
|
||||
"port": 14580,
|
||||
"softwareName": "ESP32_LoRa_iGate",
|
||||
"softwareVersion": "1.2",
|
||||
"reportingDistance": 30
|
||||
},
|
||||
"lora": {
|
||||
"iGateFreq": 433775000,
|
||||
"digirepeaterTxFreq": 433900000,
|
||||
"digirepeaterRxFreq": 433775000,
|
||||
"digirepeaterTxFreq": 433775000,
|
||||
"digirepeaterRxFreq": 433900000,
|
||||
"spreadingFactor": 12,
|
||||
"signalBandwidth": 125000,
|
||||
"codingRate4": 5,
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void loop() {
|
|||
}*/
|
||||
} else if (stationMode==1 || stationMode==2 ) { // iGate (1 Only Rx / 2 Rx+Tx)
|
||||
unsigned long currentWiFiMillis = millis();
|
||||
if ((WiFi.status() != WL_CONNECTED) && (currentWiFiMillis - previousWiFiMillis >= currentWiFi->checkInterval*1000)) {
|
||||
if ((WiFi.status() != WL_CONNECTED) && (currentWiFiMillis - previousWiFiMillis >= 30*1000)) {
|
||||
Serial.print(millis());
|
||||
Serial.println("Reconnecting to WiFi...");
|
||||
WiFi.disconnect();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void connect(){
|
|||
Serial.println("Tried: " + String(count) + " FAILED!");
|
||||
} else {
|
||||
Serial.println("Connected!\n(Server: " + String(Config.aprs_is.server) + " / Port: " + String(Config.aprs_is.port) +")");
|
||||
aprsauth = "user " + Config.callsign + " pass " + Config.aprs_is.passcode + " vers " + Config.aprs_is.softwareName + " " + Config.aprs_is.softwareVersion + " filter t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance + "\n\r";
|
||||
aprsauth = "user " + Config.callsign + " pass " + Config.aprs_is.passcode + " vers CD2RXU_LoRa_iGate 1.2 filter t/m/" + Config.callsign + "/" + (String)Config.aprs_is.reportingDistance + "\n\r";
|
||||
espClient.write(aprsauth.c_str());
|
||||
delay(200);
|
||||
}
|
||||
|
|
@ -80,12 +80,12 @@ void processLoRaPacket(String packet) {
|
|||
Serial.print(" ---> APRS LoRa Packet!");
|
||||
Sender = packet.substring(3,packet.indexOf(">"));
|
||||
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
|
||||
if (stationMode > 1) { // only answer when stationMode > 1 (with Ham Licence)
|
||||
if (stationMode == 2) {
|
||||
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 (Addressee == Config.callsign) { // its for me!
|
||||
if (AddresseeAndMessage.indexOf("{")>0) { // ack?
|
||||
ackMessage = "ack" + AddresseeAndMessage.substring(AddresseeAndMessage.indexOf("{")+1);
|
||||
ackMessage.trim();
|
||||
|
|
@ -113,7 +113,7 @@ void processLoRaPacket(String packet) {
|
|||
}
|
||||
}
|
||||
if (!queryMessage) {
|
||||
aprsPacket = APRS_IS_Utils::createPacket(packet);
|
||||
aprsPacket = createPacket(packet);
|
||||
if (!Config.display.alwaysOn) {
|
||||
display_toggle(true);
|
||||
}
|
||||
|
|
@ -138,13 +138,4 @@ void processLoRaPacket(String packet) {
|
|||
}
|
||||
}
|
||||
|
||||
/*void processSplitedMessage(String addressee, String message1, String message2) {
|
||||
espClient.write((Config.callsign + ">APRS,qAC::" + addressee + ":" + message1 + "\n").c_str());
|
||||
Serial.println("-------> " + message1);
|
||||
Serial.println("(waiting for second part)");
|
||||
delay(5000);
|
||||
espClient.write((Config.callsign + ">APRS,qAC::" + addressee + ":" + message2 + "\n").c_str());
|
||||
Serial.println("-------> " + message2);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -9,7 +9,6 @@ void connect();
|
|||
String checkStatus();
|
||||
String createPacket(String unprocessedPacket);
|
||||
void processLoRaPacket(String packet);
|
||||
//void processSplitedMessage(String addressee, String message1, String message2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
|||
JsonArray WiFiArray = data["wifi"]["AP"];
|
||||
for (int i = 0; i < WiFiArray.size(); i++) {
|
||||
WiFi_AP wifiap;
|
||||
wifiap.ssid = WiFiArray[i]["SSID"].as<String>();
|
||||
wifiap.password = WiFiArray[i]["Password"].as<String>();
|
||||
wifiap.latitude = WiFiArray[i]["Latitude"].as<double>();
|
||||
wifiap.longitude = WiFiArray[i]["Longitude"].as<double>();
|
||||
wifiap.checkInterval = data["wifi"]["checkInterval"].as<int>();
|
||||
wifiap.ssid = WiFiArray[i]["ssid"].as<String>();
|
||||
wifiap.password = WiFiArray[i]["password"].as<String>();
|
||||
wifiap.latitude = WiFiArray[i]["latitude"].as<double>();
|
||||
wifiap.longitude = WiFiArray[i]["longitude"].as<double>();
|
||||
|
||||
wifiAPs.push_back(wifiap);
|
||||
}
|
||||
|
|
@ -33,17 +32,18 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
|||
callsign = data["callsign"].as<String>();
|
||||
stationMode = data["stationMode"].as<int>();
|
||||
iGateComment = data["iGateComment"].as<String>();
|
||||
digirepeaterComment = data["digirepeaterComment"].as<String>();
|
||||
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
|
||||
statusAfterBoot = data["other"]["statusAfterBoot"].as<bool>();
|
||||
defaultStatus = data["other"]["defaultStatus"].as<String>();
|
||||
|
||||
digi.comment = data["digi"]["comment"].as<String>();
|
||||
digi.latitude = data["digi"]["latitude"].as<double>();
|
||||
digi.longitude = data["digi"]["longitude"].as<double>();
|
||||
|
||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<String>();
|
||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
aprs_is.port = data["aprs_is"]["port"].as<int>();
|
||||
aprs_is.softwareName = data["aprs_is"]["softwareName"].as<String>();
|
||||
aprs_is.softwareVersion = data["aprs_is"]["softwareVersion"].as<String>();
|
||||
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
||||
|
||||
loramodule.iGateFreq = data["lora"]["iGateFreq"].as<long>();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,13 @@ public:
|
|||
String password;
|
||||
double latitude;
|
||||
double longitude;
|
||||
int checkInterval;
|
||||
};
|
||||
|
||||
class DIGI {
|
||||
public:
|
||||
String comment;
|
||||
double latitude;
|
||||
double longitude;
|
||||
};
|
||||
|
||||
class APRS_IS {
|
||||
|
|
@ -22,8 +28,6 @@ public:
|
|||
String passcode;
|
||||
String server;
|
||||
int port;
|
||||
String softwareName;
|
||||
String softwareVersion;
|
||||
int reportingDistance;
|
||||
};
|
||||
|
||||
|
|
@ -50,12 +54,12 @@ public:
|
|||
String callsign;
|
||||
int stationMode;
|
||||
String iGateComment;
|
||||
String digirepeaterComment;
|
||||
int beaconInterval;
|
||||
int rememberStationTime;
|
||||
bool statusAfterBoot;
|
||||
String defaultStatus;
|
||||
std::vector<WiFi_AP> wifiAPs;
|
||||
DIGI digi;
|
||||
APRS_IS aprs_is;
|
||||
LoraModule loramodule;
|
||||
Display display;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void typeOfPacket(String packet) {
|
|||
}
|
||||
|
||||
void processPacket(String packet) {
|
||||
String firstPart, lastPart;
|
||||
String firstPart, lastPart, loraPacket;
|
||||
if (packet != "") {
|
||||
Serial.print("Received Lora Packet : " + String(packet));
|
||||
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1) && (packet.indexOf("WIDE1-1") > 10)) { // confirmar lo de WIDE1-1 !!!
|
||||
|
|
@ -37,12 +37,12 @@ void processPacket(String packet) {
|
|||
typeOfPacket(packet);
|
||||
firstPart = packet.substring(3,packet.indexOf(",")+1);
|
||||
lastPart = packet.substring(packet.indexOf(":"));
|
||||
Serial.println(firstPart + Config.callsign + "*" + lastPart);
|
||||
loraPacket = firstPart + Config.callsign + "*" + lastPart;
|
||||
delay(500);
|
||||
if (stationMode == 4) { // Digirepeating with Freq Rx != Tx
|
||||
LoRa_Utils::changeFreqTx();
|
||||
}
|
||||
LoRa_Utils::sendNewPacket("APRS", firstPart + Config.callsign + lastPart);
|
||||
LoRa_Utils::sendNewPacket("APRS", loraPacket);
|
||||
if (stationMode == 4) {
|
||||
LoRa_Utils::changeFreqRx();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ String double2string(double n, int ndec) {
|
|||
return r;
|
||||
}
|
||||
|
||||
String processLatitudeAPRS() {
|
||||
String degrees = double2string(currentWiFi->latitude,6);
|
||||
String processLatitudeAPRS(double lat) {
|
||||
String degrees = double2string(lat,6);
|
||||
String north_south, latitude, convDeg3;
|
||||
float convDeg, convDeg2;
|
||||
|
||||
|
|
@ -46,8 +46,8 @@ String processLatitudeAPRS() {
|
|||
return latitude;
|
||||
}
|
||||
|
||||
String processLongitudeAPRS() {
|
||||
String degrees = double2string(currentWiFi->longitude,6);
|
||||
String processLongitudeAPRS(double lon) {
|
||||
String degrees = double2string(lon,6);
|
||||
String east_west, longitude, convDeg3;
|
||||
float convDeg, convDeg2;
|
||||
|
||||
|
|
@ -73,18 +73,21 @@ String processLongitudeAPRS() {
|
|||
}
|
||||
|
||||
String generateBeacon() {
|
||||
String iGateLat = processLatitudeAPRS();
|
||||
String iGateLon = processLongitudeAPRS();
|
||||
String beaconPacket = Config.callsign + ">APLRG1";
|
||||
if (stationMode == 1) {
|
||||
beaconPacket += ",qAC:=" +iGateLat + "L" + iGateLon + "&";
|
||||
String stationLatitude, stationLongitude, beaconPacket;
|
||||
if (stationMode==1 || stationMode==2) {
|
||||
stationLatitude = processLatitudeAPRS(currentWiFi->latitude);
|
||||
stationLongitude = processLongitudeAPRS(currentWiFi->longitude);
|
||||
beaconPacket = Config.callsign + ">APLRG1,qAC:=" + stationLatitude + "L" + stationLongitude;
|
||||
if (stationMode == 1) {
|
||||
beaconPacket += "&";
|
||||
} else {
|
||||
beaconPacket += "a";
|
||||
}
|
||||
beaconPacket += Config.iGateComment;
|
||||
} else if (stationMode == 2 || stationMode == 5) {
|
||||
beaconPacket += ",qAC:=" + iGateLat + "L" + iGateLon + "a";
|
||||
beaconPacket += Config.iGateComment;
|
||||
} else if (stationMode ==3 || stationMode == 4) {
|
||||
beaconPacket += ":=" + iGateLat + "L" + iGateLon + "#";
|
||||
beaconPacket += Config.digirepeaterComment;
|
||||
} else { //stationMode 3 y 4
|
||||
stationLatitude = processLatitudeAPRS(Config.digi.latitude);
|
||||
stationLongitude = processLongitudeAPRS(Config.digi.longitude);
|
||||
beaconPacket = Config.callsign + ">APLRG1:=" + stationLatitude + "L" + stationLongitude + "#" + Config.digi.comment;
|
||||
}
|
||||
return beaconPacket;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ String process(String query, String station, String queryOrigin) {
|
|||
if (query=="?APRS?" || query=="?aprs?" || query=="?Aprs?" || query=="H" || query=="h" || query=="Help" || query=="help" || query=="?") {
|
||||
answer = "?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign";
|
||||
} else if (query=="?APRSV" || query=="?aprsv" || query=="?Aprsv") {
|
||||
answer = Config.aprs_is.softwareName + " " + Config.aprs_is.softwareVersion;
|
||||
answer = "CD2RXU_LoRa_iGate 1.2";
|
||||
} else if (query=="?APRSP" || query=="?aprsp" || query=="?Aprsp") {
|
||||
answer = "iGate QTH: " + String(currentWiFi->latitude,2) + " " + String(currentWiFi->longitude,2);
|
||||
} else if (query=="?APRSL" || query=="?aprsl" || query=="?Aprsl") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue