comitTest1
This commit is contained in:
parent
006f58f287
commit
40525930af
|
|
@ -24,6 +24,7 @@
|
||||||
"reportingDistance": 30
|
"reportingDistance": 30
|
||||||
},
|
},
|
||||||
"lora": {
|
"lora": {
|
||||||
|
"enableTx": true,
|
||||||
"frequency": 433775000,
|
"frequency": 433775000,
|
||||||
"spreadingFactor": 12,
|
"spreadingFactor": 12,
|
||||||
"signalBandwidth": 125000,
|
"signalBandwidth": 125000,
|
||||||
|
|
@ -36,7 +37,7 @@
|
||||||
},
|
},
|
||||||
"other": {
|
"other": {
|
||||||
"beaconInterval": 15,
|
"beaconInterval": 15,
|
||||||
"defaultStatusAfterBoot": true,
|
"statusAfterBoot": true,
|
||||||
"defaultStatus": "https://github.com/richonguzman/LoRa_APRS_iGate"
|
"defaultStatus": "https://github.com/richonguzman/LoRa_APRS_iGate"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ static uint32_t lastRxTxTime = millis();
|
||||||
static int myWiFiAPIndex = 0;
|
static int myWiFiAPIndex = 0;
|
||||||
int myWiFiAPSize = Config.wifiAPs.size();
|
int myWiFiAPSize = Config.wifiAPs.size();
|
||||||
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
|
||||||
bool defaultStatusAfterBoot = Config.defaultStatusAfterBoot;
|
bool statusAfterBoot = Config.statusAfterBoot;
|
||||||
|
|
||||||
std::vector<String> lastHeardStation;
|
std::vector<String> lastHeardStation;
|
||||||
std::vector<String> lastHeardStation_temp;
|
std::vector<String> lastHeardStation_temp;
|
||||||
|
|
@ -87,7 +87,11 @@ String createAPRSPacket(String unprocessedPacket) {
|
||||||
int dotsPosition = unprocessedPacket.indexOf(':');
|
int dotsPosition = unprocessedPacket.indexOf(':');
|
||||||
callsign_and_path_tracker = unprocessedPacket.substring(3, dotsPosition);
|
callsign_and_path_tracker = unprocessedPacket.substring(3, dotsPosition);
|
||||||
payload_tracker = unprocessedPacket.substring(dotsPosition);
|
payload_tracker = unprocessedPacket.substring(dotsPosition);
|
||||||
|
if (Config.loramodule.enableTx) {
|
||||||
|
processedPacket = callsign_and_path_tracker + ",qAR," + Config.callsign + payload_tracker + "\n";
|
||||||
|
} else {
|
||||||
processedPacket = callsign_and_path_tracker + ",qAO," + Config.callsign + payload_tracker + "\n";
|
processedPacket = callsign_and_path_tracker + ",qAO," + Config.callsign + payload_tracker + "\n";
|
||||||
|
}
|
||||||
return processedPacket;
|
return processedPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,6 +186,7 @@ void checkReceivedPacket(String packet) {
|
||||||
Serial.print(" ---> APRS LoRa Packet!");
|
Serial.print(" ---> APRS LoRa Packet!");
|
||||||
Sender = packet.substring(3,packet.indexOf(">"));
|
Sender = packet.substring(3,packet.indexOf(">"));
|
||||||
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
|
if (Sender != Config.callsign) { // avoid listening yourself by digirepeating
|
||||||
|
if (Config.loramodule.enableTx) {
|
||||||
if (packet.indexOf("::") > 10) { // its a Message!
|
if (packet.indexOf("::") > 10) { // its a Message!
|
||||||
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
AddresseeAndMessage = packet.substring(packet.indexOf("::")+2);
|
||||||
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));
|
Addressee = AddresseeAndMessage.substring(0,AddresseeAndMessage.indexOf(":"));
|
||||||
|
|
@ -213,6 +218,7 @@ void checkReceivedPacket(String packet) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!queryMessage) {
|
if (!queryMessage) {
|
||||||
aprsPacket = createAPRSPacket(packet);
|
aprsPacket = createAPRSPacket(packet);
|
||||||
if (!Config.display.alwaysOn) {
|
if (!Config.display.alwaysOn) {
|
||||||
|
|
@ -386,9 +392,14 @@ void loop() {
|
||||||
if (beacon_update) {
|
if (beacon_update) {
|
||||||
display_toggle(true);
|
display_toggle(true);
|
||||||
Serial.println("---- Sending iGate Beacon ----");
|
Serial.println("---- Sending iGate Beacon ----");
|
||||||
String iGateBeaconPacket = Config.callsign + ">APLR10,qAC:=" + iGateLatitude + "L" + iGateLongitude + "&" + Config.comment + "\n";
|
String iGateBeaconPacket = Config.callsign + ">APLR10,";
|
||||||
|
if (Config.loramodule.enableTx) {
|
||||||
|
iGateBeaconPacket += "qAC:=" + iGateLatitude + "L" + iGateLongitude + "a" + Config.comment;
|
||||||
|
} else {
|
||||||
|
iGateBeaconPacket += "qAC:=" + iGateLatitude + "L" + iGateLongitude + "&" + Config.comment;
|
||||||
|
}
|
||||||
//Serial.println(iGateBeaconPacket);
|
//Serial.println(iGateBeaconPacket);
|
||||||
espClient.write(iGateBeaconPacket.c_str());
|
espClient.write((iGateBeaconPacket + "\n").c_str());
|
||||||
lastTxTime = millis();
|
lastTxTime = millis();
|
||||||
lastRxTxTime = millis();
|
lastRxTxTime = millis();
|
||||||
show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 1000);
|
show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 1000);
|
||||||
|
|
@ -457,11 +468,13 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (defaultStatusAfterBoot) {
|
if (statusAfterBoot) {
|
||||||
|
Serial.println(Config.defaultStatus);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
String startupStatus = Config.callsign + ">APLR10,qAC:>" + Config.defaultStatus + "\n";
|
//String startupStatus = Config.callsign + ">APLR10,qAC:>" + Config.defaultStatus;
|
||||||
espClient.write(startupStatus.c_str());
|
String startupStatus = Config.callsign + ">APLR10,qAC:>" + "https://github.com/richonguzman/LoRa_APRS_iGate";
|
||||||
defaultStatusAfterBoot = false;
|
espClient.write((startupStatus + "\n").c_str());
|
||||||
|
statusAfterBoot = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,6 +27,7 @@ public:
|
||||||
|
|
||||||
class LoraModule {
|
class LoraModule {
|
||||||
public:
|
public:
|
||||||
|
bool enableTx;
|
||||||
long frequency;
|
long frequency;
|
||||||
int spreadingFactor;
|
int spreadingFactor;
|
||||||
long signalBandwidth;
|
long signalBandwidth;
|
||||||
|
|
@ -45,13 +46,13 @@ public:
|
||||||
|
|
||||||
String callsign;
|
String callsign;
|
||||||
String comment;
|
String comment;
|
||||||
|
int beaconInterval;
|
||||||
|
bool statusAfterBoot;
|
||||||
|
String defaultStatus;
|
||||||
std::vector<WiFi_AP> wifiAPs;
|
std::vector<WiFi_AP> wifiAPs;
|
||||||
APRS_IS aprs_is;
|
APRS_IS aprs_is;
|
||||||
LoraModule loramodule;
|
LoraModule loramodule;
|
||||||
Display display;
|
Display display;
|
||||||
int beaconInterval;
|
|
||||||
bool defaultStatusAfterBoot;
|
|
||||||
String defaultStatus;
|
|
||||||
|
|
||||||
Configuration(String &filePath) {
|
Configuration(String &filePath) {
|
||||||
_filePath = filePath;
|
_filePath = filePath;
|
||||||
|
|
@ -86,6 +87,9 @@ private:
|
||||||
|
|
||||||
callsign = data["callsign"].as<String>();
|
callsign = data["callsign"].as<String>();
|
||||||
comment = data["comment"].as<String>();
|
comment = data["comment"].as<String>();
|
||||||
|
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||||
|
statusAfterBoot = data["other"]["statusAfterBoot"].as<bool>();
|
||||||
|
defaultStatus = data["other"]["defaultStatus"].as<String>();
|
||||||
|
|
||||||
aprs_is.passcode = data["aprs_is"]["passcode"].as<int>();
|
aprs_is.passcode = data["aprs_is"]["passcode"].as<int>();
|
||||||
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||||
|
|
@ -94,6 +98,7 @@ private:
|
||||||
aprs_is.softwareVersion = data["aprs_is"]["softwareVersion"].as<String>();
|
aprs_is.softwareVersion = data["aprs_is"]["softwareVersion"].as<String>();
|
||||||
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
||||||
|
|
||||||
|
loramodule.enableTx = data["lora"]["enableTx"].as<bool>();
|
||||||
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
||||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||||
|
|
@ -103,15 +108,7 @@ private:
|
||||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
||||||
display.timeout = data["display"]["timeout"].as<int>();
|
display.timeout = data["display"]["timeout"].as<int>();
|
||||||
|
|
||||||
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
|
||||||
defaultStatusAfterBoot = data["other"]["defaultStatusAfterBoot"].as<bool>();
|
|
||||||
defaultStatus = data["other"]["defaultStatus"].as<String>();
|
|
||||||
|
|
||||||
configFile.close();
|
configFile.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//bool defaultStatusAfterBoot = true;
|
|
||||||
/*String defaultStatus = "https://github.com/richonguzman/LoRa_APRS_iGate";
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue