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