diff --git a/data/tracker.json b/data/tracker.json index 7cd83dd..87a2715 100644 --- a/data/tracker.json +++ b/data/tracker.json @@ -1,23 +1,21 @@ { "debug": false, "enhance_precision": true, - "beacons": - [ + "beacons": [ { "callsign": "NOCALL-7", + "path": "WIDE1-1", "message": "LoRa Tracker", "timeout": 1, "symbol": "[", "overlay": "/" } ], - "button": - { + "button": { "tx": true, "alt_message": true }, - "smart_beacon": - { + "smart_beacon": { "active": true, "turn_min": 25, "slow_rate": 300, @@ -27,8 +25,7 @@ "min_tx_dist": 100, "min_bcn": 5 }, - "lora": - { + "lora": { "frequency_rx": 433775000, "frequency_tx": 433775000, "power": 20, @@ -36,12 +33,11 @@ "signal_bandwidth": 125000, "coding_rate4": 5 }, - "ptt_output": - { + "ptt_output": { "active": false, "io_pin": 4, "start_delay": 0, "end_delay": 0, "reverse": false } -} \ No newline at end of file +} diff --git a/src/LoRa_APRS_Tracker.cpp b/src/LoRa_APRS_Tracker.cpp index 266133c..9a265ed 100644 --- a/src/LoRa_APRS_Tracker.cpp +++ b/src/LoRa_APRS_Tracker.cpp @@ -186,7 +186,7 @@ void loop() { } if (send_update && gps_loc_update) { - send_update = false; + send_update = false; Configuration::Beacon beacon = Config.GetCurrentBeacon(); nextBeaconTimeStamp = now() + (Config.smart_beacon.active ? Config.smart_beacon.slow_rate : (beacon.timeout * SECS_PER_MIN)); @@ -197,6 +197,7 @@ void loop() { String dao; msg.setSource(beacon.callsign); + msg.setPath(beacon.path); msg.setDestination("APLT00-1"); if (!Config.enhance_precision) { diff --git a/src/configuration.cpp b/src/configuration.cpp index 52945a5..660c18f 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -43,6 +43,8 @@ Configuration ConfigurationManagement::readConfiguration() { if (v.containsKey("callsign")) beacon.callsign = v["callsign"].as(); + if (v.containsKey("path")) + beacon.path = v["path"].as(); if (v.containsKey("message")) beacon.message = v["message"].as(); beacon.timeout = v["timeout"] | 1; @@ -62,9 +64,9 @@ Configuration ConfigurationManagement::readConfiguration() { conf.smart_beacon.fast_speed = data["smart_beacon"]["fast_speed"] | 100; conf.smart_beacon.min_tx_dist = data["smart_beacon"]["min_tx_dist"] | 100; conf.smart_beacon.min_bcn = data["smart_beacon"]["min_bcn"] | 5; - - conf.button.tx = data["button"]["tx"] | false; - conf.button.alt_message = data["button"]["alt_message"] | false; + + conf.button.tx = data["button"]["tx"] | false; + conf.button.alt_message = data["button"]["alt_message"] | false; conf.lora.frequencyRx = data["lora"]["frequency_rx"] | 433775000; conf.lora.frequencyTx = data["lora"]["frequency_tx"] | 433775000; @@ -95,17 +97,18 @@ void ConfigurationManagement::writeConfiguration(Configuration conf) { for (Configuration::Beacon beacon : conf.beacons) { JsonObject v = beacons.createNestedObject(); v["callsign"] = beacon.callsign; + v["path"] = beacon.path; v["message"] = beacon.message; v["timeout"] = beacon.timeout; v["symbol"] = beacon.symbol; v["overlay"] = beacon.overlay; } - data["debug"] = conf.debug; - data["enhance_precision"] = conf.enhance_precision; + data["debug"] = conf.debug; + data["enhance_precision"] = conf.enhance_precision; - data["button"]["tx"] = conf.button.tx; - data["button"]["alt_message"] = conf.button.alt_message; + data["button"]["tx"] = conf.button.tx; + data["button"]["alt_message"] = conf.button.alt_message; data["smart_beacon"]["active"] = conf.smart_beacon.active; data["smart_beacon"]["turn_min"] = conf.smart_beacon.turn_min; @@ -144,4 +147,4 @@ Configuration::Beacon Configuration::SetNextBeacon() { if (this->current_beacon_index >= this->beacons.size()) this->current_beacon_index = 0; return this->GetCurrentBeacon(); -} \ No newline at end of file +} diff --git a/src/configuration.h b/src/configuration.h index 2aca0fe..1653cb0 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -1,8 +1,8 @@ #ifndef CONFIGURATION_H_ #define CONFIGURATION_H_ -#include #include +#include #include @@ -10,10 +10,11 @@ class Configuration { public: class Beacon { public: - Beacon() : callsign("NOCALL-10"), message("LoRa Tracker, Info: github.com/lora-aprs/LoRa_APRS_Tracker"), timeout(1), symbol("["), overlay("/") { + Beacon() : callsign("NOCALL-10"), path("WIDE1-1"), message("LoRa Tracker"), timeout(1), symbol("["), overlay("/") { } String callsign; + String path; String message; int timeout; String symbol; @@ -69,16 +70,16 @@ public: int alt_message; }; - Configuration() : debug(false), enhance_precision(true), current_beacon_index(0) {}; + Configuration() : debug(false), enhance_precision(true), current_beacon_index(0){}; - bool debug; - bool enhance_precision; - std::list beacons; - int current_beacon_index; - Smart_Beacon smart_beacon; - LoRa lora; - PTT ptt; - Button button; + bool debug; + bool enhance_precision; + std::list beacons; + int current_beacon_index; + Smart_Beacon smart_beacon; + LoRa lora; + PTT ptt; + Button button; Beacon GetCurrentBeacon(); Beacon SetNextBeacon();