commit
54ce3fe267
27
README.md
27
README.md
|
@ -1,4 +1,6 @@
|
|||
# LoRa APRS Tracker
|
||||
# LoRa APRS Tracker
|
||||
|
||||
Forked from <https://github.com/lora-aprs/LoRa_APRS_Tracker>, Peter, OE5BPA
|
||||
|
||||
The LoRa APRS Tracker will work with very cheep hardware which you can buy from amazon, ebay or aliexpress.
|
||||
Try it out and be part of the APRS network.
|
||||
|
@ -15,12 +17,9 @@ You can use one of the Lora32 boards:
|
|||
This boards cost around 30 Euros, they are very cheap but perfect for an LoRa iGate.
|
||||
Keep in minde: you need a 433MHz version!
|
||||
|
||||
## Compiling
|
||||
## Intention
|
||||
|
||||
### How to compile
|
||||
|
||||
The best success is to use PlatformIO. Go to https://platformio.org/ and download the IDE. Just open the folder and you can compile the Firmware.
|
||||
Here is a [Video](https://www.youtube.com/watch?v=clIlTEFbWLk&feature=emb_logo) tutorial in german language how to install the software.
|
||||
I forked this version because of my intention to build a specialized tracker for my mobile home. It should collect data from some sensors, weather condition etc. and send it to the APRS-System in two ways: If no wifi is present, it should just send the Packet to 433 MHz. If a known wifi is present, it should try to send the packet via wifi to the APRS-System direct.
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
@ -32,12 +31,20 @@ Here is a [Video](https://www.youtube.com/watch?v=clIlTEFbWLk&feature=emb_logo)
|
|||
|
||||
## Configuration
|
||||
|
||||
Change your configuration in settings.h
|
||||
Change your configuration in /data/is-cfg,json
|
||||
|
||||
## Future plans
|
||||
|
||||
The complete configuration should move to [IotWebConf](https://github.com/prampec/IotWebConf).
|
||||
At the source i forked the complete configuration may move to [IotWebConf](https://github.com/prampec/IotWebConf).
|
||||
It may possible i move too...
|
||||
|
||||
## LoRa iGate
|
||||
* [ ] add sending packet direct via wifi to aprs-net (using work from Peter, OE5BPA)
|
||||
* [ ] some refactoring
|
||||
* [ ] REST-API or communication with webserver
|
||||
* [ ] web-page sensors information
|
||||
* [ ] etc.
|
||||
|
||||
Look at my other project: a [LoRa iGate](https://github.com/peterus/LoRa_APRS_iGate)
|
||||
# History
|
||||
|
||||
01.03.2021 Forked
|
||||
05.03.2021 Moved configuration to json-file in filesystem
|
||||
|
|
38
data/is-cfg.json
Normal file
38
data/is-cfg.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"callsign":"NOCALL-10",
|
||||
"debug": false,
|
||||
"beacon":
|
||||
{
|
||||
"message":"TTGO LoRA-APRS Tracker",
|
||||
"timeout": 1,
|
||||
"symbol": "[",
|
||||
"overlay": "/"
|
||||
},
|
||||
"smart_beacon":
|
||||
{
|
||||
"active":false,
|
||||
"turn_min":25,
|
||||
"slow_rate":300,
|
||||
"slow_speed":10,
|
||||
"fast_rate":60,
|
||||
"fast_speed":100,
|
||||
"min_tx_dist":100,
|
||||
"min_bcn":5
|
||||
},
|
||||
"wifi":
|
||||
{
|
||||
"active":false,
|
||||
"AP": [
|
||||
{ "SSID":"yourssid", "password":"yoursecrets" }
|
||||
]
|
||||
},
|
||||
"lora":
|
||||
{
|
||||
"frequency_rx":433775E3,
|
||||
"frequency_tx":433775E3,
|
||||
"power":20,
|
||||
"spreading_factor":12,
|
||||
"signal_bandwidth":125E3,
|
||||
"coding_rate4":5
|
||||
}
|
||||
}
|
|
@ -4,24 +4,29 @@
|
|||
#include <TinyGPS++.h>
|
||||
#include <TimeLib.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#include "settings.h"
|
||||
#include "display.h"
|
||||
#include "pins.h"
|
||||
#include "power_management.h"
|
||||
#include "configuration.h"
|
||||
Configuration Config;
|
||||
|
||||
#include "power_management.h"
|
||||
PowerManagement powerManagement;
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
HardwareSerial ss(1);
|
||||
TinyGPSPlus gps;
|
||||
|
||||
void setup_lora();
|
||||
void setup_gps();
|
||||
void load_config();
|
||||
|
||||
String create_lat_aprs(RawDegrees lat);
|
||||
String create_long_aprs(RawDegrees lng);
|
||||
String createDateString(time_t t);
|
||||
String createTimeString(time_t t);
|
||||
String getSmartBeaconState();
|
||||
|
||||
static bool send_update = true;
|
||||
|
||||
|
@ -37,6 +42,7 @@ int lastTxTime = millis();
|
|||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
|
||||
#ifdef TTGO_T_Beam_V1_0
|
||||
Wire.begin(SDA, SCL);
|
||||
|
@ -57,13 +63,10 @@ void setup()
|
|||
delay(500);
|
||||
Serial.println("[INFO] LoRa APRS Tracker by OE5BPA (Peter Buchegger)");
|
||||
setup_display();
|
||||
show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", 2000);
|
||||
|
||||
#ifdef SB_ACTIVE
|
||||
Serial.println("[INFO] Smart Beaconing Active");
|
||||
show_display("DJ1AN", "Smart Beaconing","Active", 1000);
|
||||
#endif
|
||||
|
||||
|
||||
show_display("OE5BPA", "LoRa APRS Tracker", "by Peter Buchegger", "[INFO] Smart Beacon is " + getSmartBeaconState(), 2000);
|
||||
load_config();
|
||||
|
||||
setup_gps();
|
||||
setup_lora();
|
||||
|
||||
|
@ -71,28 +74,31 @@ void setup()
|
|||
WiFi.mode(WIFI_OFF);
|
||||
btStop();
|
||||
|
||||
delay(500);
|
||||
Serial.println("[INFO] Smart Beacon is " + getSmartBeaconState());
|
||||
Serial.println("[INFO] setup done...");
|
||||
delay(500);
|
||||
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void loop()
|
||||
{
|
||||
#if !defined(DEBUGMODE)
|
||||
if (Config.debug == false)
|
||||
while (ss.available() > 0)
|
||||
{
|
||||
char c = ss.read();
|
||||
//Serial.print(c);
|
||||
gps.encode(c);
|
||||
}
|
||||
#else
|
||||
else
|
||||
{
|
||||
while (Serial.available() > 0)
|
||||
{
|
||||
char c = Serial.read();
|
||||
//Serial.print(c);
|
||||
gps.encode(c);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool gps_time_update = gps.time.isUpdated();
|
||||
bool gps_loc_update = gps.location.isUpdated();
|
||||
|
@ -109,7 +115,8 @@ void loop()
|
|||
|
||||
}
|
||||
|
||||
#ifdef SB_ACTIVE
|
||||
if (Config.smart_beacon.active)
|
||||
{
|
||||
send_update = false;
|
||||
if ( gps_loc_update )
|
||||
{
|
||||
|
@ -128,15 +135,15 @@ void loop()
|
|||
}
|
||||
headingDelta = (int) ( previousHeading - currentHeading ) % 360;
|
||||
int turn_slope = 100;
|
||||
headingTresh = (float) SB_TURN_MIN + turn_slope / gps.speed.kmph();
|
||||
headingTresh = (float) Config.smart_beacon.turn_min + turn_slope / gps.speed.kmph();
|
||||
|
||||
int lastTx = millis() - lastTxTime;
|
||||
|
||||
if ( lastTx > SB_MIN_BCN * 1000)
|
||||
if ( lastTx > Config.smart_beacon.min_bcn * 1000)
|
||||
{
|
||||
//send_update = true;
|
||||
// Check for heading more than 25 degrees
|
||||
if ( (headingDelta < -SB_TURN_MIN || headingDelta > SB_TURN_MIN) && lastTxdistance > SB_MIN_TX_DIST )
|
||||
if ( (headingDelta < -Config.smart_beacon.turn_min || headingDelta > Config.smart_beacon.turn_min) && lastTxdistance > Config.smart_beacon.min_tx_dist )
|
||||
{
|
||||
send_update = true;
|
||||
}
|
||||
|
@ -152,20 +159,29 @@ void loop()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(send_update && gps.location.isValid() && gps_loc_update)
|
||||
{
|
||||
#ifdef TTGO_T_Beam_V1_0
|
||||
String volts = "Bat.: " + powerManagement.getBatteryVoltageStr() + " V";
|
||||
String amps = "Cur.:" + powerManagement.getBatteryChargeDischargeCurrentStr() + " mA";
|
||||
String sats = String("Sats: ") + gps.satellites.value();
|
||||
|
||||
#endif
|
||||
powerManagement.deactivateMeasurement();
|
||||
nextBeaconTimeStamp = now() + (BEACON_TIMEOUT * SECS_PER_MIN);
|
||||
|
||||
nextBeaconTimeStamp = now() + (Config.beacon.timeout * SECS_PER_MIN);
|
||||
String nextbcnStr = String("Nxt Bcn: ") + createTimeString(nextBeaconTimeStamp);
|
||||
send_update = false;
|
||||
|
||||
APRSMessage msg;
|
||||
msg.setSource(CALL);
|
||||
msg.setSource(Config.callsign);
|
||||
msg.setDestination("APLT0");
|
||||
String lat = create_lat_aprs(gps.location.rawLat());
|
||||
String lng = create_long_aprs(gps.location.rawLng());
|
||||
msg.getAPRSBody()->setData(String("=") + lat + SYMBOL_OVERLAY + lng + SYMBOL_CODE + BEACON_MESSAGE);
|
||||
|
||||
msg.getAPRSBody()->setData(String("=") + lat + Config.beacon.overlay + lng + Config.beacon.symbol + Config.beacon.message + " - " + volts + " - " + amps + " - " + sats);
|
||||
String data = msg.encode();
|
||||
Serial.println(data);
|
||||
show_display("<< TX >>", data);
|
||||
|
@ -179,14 +195,14 @@ void loop()
|
|||
LoRa.endPacket();
|
||||
powerManagement.activateMeasurement();
|
||||
|
||||
#ifdef SB_ACTIVE
|
||||
lastTxLat = gps.location.lat();
|
||||
lastTxLng = gps.location.lng();
|
||||
previousHeading = currentHeading;
|
||||
lastTxdistance = 0;
|
||||
lastTxTime = millis();
|
||||
#endif
|
||||
|
||||
if (Config.smart_beacon.active)
|
||||
{
|
||||
lastTxLat = gps.location.lat();
|
||||
lastTxLng = gps.location.lng();
|
||||
previousHeading = currentHeading;
|
||||
lastTxdistance = 0;
|
||||
lastTxTime = millis();
|
||||
}
|
||||
}
|
||||
|
||||
if(gps_time_update)
|
||||
|
@ -196,44 +212,46 @@ void loop()
|
|||
String batteryChargeCurrent(powerManagement.getBatteryChargeDischargeCurrent(), 0);
|
||||
#endif
|
||||
|
||||
show_display(CALL,
|
||||
show_display(Config.callsign,
|
||||
createDateString(now()) + " " + createTimeString(now()),
|
||||
String("Sats: ") + gps.satellites.value() + " HDOP: " + gps.hdop.hdop(),
|
||||
String("Nxt Bcn: ") + createTimeString(nextBeaconTimeStamp)
|
||||
#ifdef TTGO_T_Beam_V1_0
|
||||
, String("Bat: ") + batteryVoltage + "V " + batteryChargeCurrent + "mA"
|
||||
#endif
|
||||
, String("Smart Beacon is " + getSmartBeaconState())
|
||||
);
|
||||
|
||||
#ifdef SB_ACTIVE
|
||||
// Change the Tx internal based on the current speed
|
||||
if ( gps.speed.kmph() < 5 )
|
||||
{
|
||||
txInterval = 300000; // Change Tx internal to 5 mins
|
||||
}
|
||||
else if ( gps.speed.kmph() < SB_SLOW_SPEED )
|
||||
{
|
||||
txInterval = SB_SLOW_RATE * 1000; // Change Tx interval
|
||||
}
|
||||
else if ( gps.speed.kmph() > SB_FAST_SPEED)
|
||||
{
|
||||
txInterval = SB_FAST_RATE * 1000; // Change Tx interval
|
||||
}
|
||||
else
|
||||
{
|
||||
// Interval inbetween low and high speed
|
||||
txInterval = (SB_FAST_SPEED / gps.speed.kmph()) * SB_FAST_RATE * 1000;
|
||||
}
|
||||
#endif
|
||||
if (Config.smart_beacon.active)
|
||||
{
|
||||
// Change the Tx internal based on the current speed
|
||||
if ( gps.speed.kmph() < 5 )
|
||||
{
|
||||
txInterval = 300000; // Change Tx internal to 5 mins
|
||||
}
|
||||
else if ( gps.speed.kmph() < Config.smart_beacon.slow_speed )
|
||||
{
|
||||
txInterval = Config.smart_beacon.slow_rate * 1000; // Change Tx interval
|
||||
}
|
||||
else if ( gps.speed.kmph() > Config.smart_beacon.fast_speed)
|
||||
{
|
||||
txInterval = Config.smart_beacon.fast_rate * 1000; // Change Tx interval
|
||||
}
|
||||
else
|
||||
{
|
||||
// Interval inbetween low and high speed
|
||||
txInterval = (Config.smart_beacon.fast_speed / gps.speed.kmph()) * Config.smart_beacon.fast_rate * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !defined(DEBUGMODE)
|
||||
if(millis() > 5000 && gps.charsProcessed() < 10)
|
||||
|
||||
if ((Config.debug == false) && (millis() > 5000 && gps.charsProcessed() < 10))
|
||||
{
|
||||
Serial.println("No GPS detected!");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -245,7 +263,7 @@ void setup_lora()
|
|||
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
|
||||
Serial.println("[INFO] Set LoRa pins!");
|
||||
|
||||
long freq = FREQ_SET;
|
||||
long freq = Config.lora.frequencyTx;
|
||||
Serial.print("[INFO] frequency: ");
|
||||
Serial.println(freq);
|
||||
if (!LoRa.begin(freq)) {
|
||||
|
@ -253,9 +271,9 @@ void setup_lora()
|
|||
show_display("ERROR", "Starting LoRa failed!");
|
||||
while (1);
|
||||
}
|
||||
LoRa.setSpreadingFactor(SF_SET);
|
||||
LoRa.setSignalBandwidth(BW_SET);
|
||||
LoRa.setCodingRate4(CR_SET);
|
||||
LoRa.setSpreadingFactor(Config.lora.spreadingFactor);
|
||||
LoRa.setSignalBandwidth(Config.lora.signalBandwidth);
|
||||
LoRa.setCodingRate4(Config.lora.codingRate4);
|
||||
LoRa.enableCrc();
|
||||
|
||||
LoRa.setTxPower(20);
|
||||
|
@ -268,6 +286,28 @@ void setup_gps()
|
|||
ss.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);
|
||||
}
|
||||
|
||||
void load_config()
|
||||
{
|
||||
ConfigurationManagement confmg("/is-cfg.json");
|
||||
Config = confmg.readConfiguration();
|
||||
if(Config.callsign == "NOCALL-10")
|
||||
{
|
||||
logPrintlnE("You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
show_display("ERROR", "You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
while (true)
|
||||
{}
|
||||
}
|
||||
|
||||
#ifndef ETH_BOARD
|
||||
if(Config.aprs_is.active && !Config.wifi.active)
|
||||
{
|
||||
logPrintlnE("You have to activate Wifi for APRS IS to work, please check your settings!");
|
||||
show_display("ERROR", "You have to activate Wifi for APRS IS to work, please check your settings!");
|
||||
while (true)
|
||||
{}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
String create_lat_aprs(RawDegrees lat)
|
||||
{
|
||||
char str[20];
|
||||
|
@ -311,3 +351,17 @@ String createTimeString(time_t t)
|
|||
sprintf(line, "%02d:%02d:%02d", hour(t), minute(t), second(t));
|
||||
return String(line);
|
||||
}
|
||||
|
||||
String getSmartBeaconState()
|
||||
{
|
||||
String sm_beaconstate = "";
|
||||
if (Config.smart_beacon.active == true)
|
||||
{
|
||||
sm_beaconstate = "On";
|
||||
}
|
||||
else
|
||||
{
|
||||
sm_beaconstate = "Off";
|
||||
}
|
||||
return sm_beaconstate;
|
||||
}
|
||||
|
|
175
src/configuration.cpp
Normal file
175
src/configuration.cpp
Normal file
|
@ -0,0 +1,175 @@
|
|||
#include <SPIFFS.h>
|
||||
|
||||
#include "configuration.h"
|
||||
#include "logger.h"
|
||||
|
||||
ConfigurationManagement::ConfigurationManagement(String FilePath)
|
||||
: mFilePath(FilePath)
|
||||
{
|
||||
if(!SPIFFS.begin(true))
|
||||
{
|
||||
logPrintlnE("Mounting SPIFFS was not possible. Trying to format SPIFFS...");
|
||||
SPIFFS.format();
|
||||
if(!SPIFFS.begin())
|
||||
{
|
||||
logPrintlnE("Formating SPIFFS was not okay!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Configuration ConfigurationManagement::readConfiguration()
|
||||
{
|
||||
File file = SPIFFS.open(mFilePath);
|
||||
if(!file)
|
||||
{
|
||||
Serial.println("Failed to open file for reading...");
|
||||
return Configuration();
|
||||
}
|
||||
DynamicJsonDocument data(2048);
|
||||
DeserializationError error = deserializeJson(data, file); // update config in memory to get the new fields:
|
||||
// writeConfiguration(conf);
|
||||
|
||||
if(error)
|
||||
{
|
||||
Serial.println("Failed to read file, using default configuration.");
|
||||
}
|
||||
serializeJson(data, Serial);
|
||||
Serial.println();
|
||||
file.close();
|
||||
|
||||
Configuration conf;
|
||||
if(data.containsKey("debug"))
|
||||
conf.debug = data["debug"] | false;
|
||||
if(data.containsKey("callsign"))
|
||||
conf.callsign = data["callsign"].as<String>();
|
||||
|
||||
conf.wifi.active = data["wifi"]["active"] | false;
|
||||
JsonArray aps = data["wifi"]["AP"].as<JsonArray>();
|
||||
for(JsonVariant v : aps)
|
||||
{
|
||||
Configuration::Wifi::AP ap;
|
||||
ap.SSID = v["SSID"].as<String>();
|
||||
ap.password = v["password"].as<String>();
|
||||
conf.wifi.APs.push_back(ap);
|
||||
}
|
||||
if(data.containsKey("beacon") && data["beacon"].containsKey("message"))
|
||||
conf.beacon.message = data["beacon"]["message"].as<String>();
|
||||
|
||||
conf.beacon.timeout = data["beacon"]["timeout"] | 1;
|
||||
conf.beacon.symbol = data["beacon"]["symbol"].as<String>();
|
||||
conf.beacon.overlay = data["beacon"]["overlay"].as<String>() ;
|
||||
|
||||
|
||||
conf.smart_beacon.active = data["smart_beacon"]["active"];
|
||||
conf.smart_beacon.turn_min = data["smart_beacon"]["turn_min"];
|
||||
conf.smart_beacon.slow_rate = data["smart_beacon"]["slow_rate"];
|
||||
conf.smart_beacon.slow_speed = data["smart_beacon"]["slow_speed"];
|
||||
conf.smart_beacon.fast_rate = data["smart_beacon"]["fast_rate"];
|
||||
conf.smart_beacon.fast_speed = data["smart_beacon"]["fast_speed"];
|
||||
conf.smart_beacon.min_tx_dist = data["smart_beacon"]["min_tx_dist"];
|
||||
conf.smart_beacon.min_bcn = data["smart_beacon"]["min_bcn"];
|
||||
|
||||
conf.aprs_is.active = data["aprs_is"]["active"] | false;
|
||||
if(data.containsKey("aprs_is") && data["aprs_is"].containsKey("password"))
|
||||
conf.aprs_is.password = data["aprs_is"]["password"].as<String>();
|
||||
if(data.containsKey("aprs_is") && data["aprs_is"].containsKey("server"))
|
||||
conf.aprs_is.server = data["aprs_is"]["server"].as<String>();
|
||||
conf.aprs_is.port = data["aprs_is"]["port"] | 14580;
|
||||
conf.aprs_is.beacon = data["aprs_is"]["beacon"] | true;
|
||||
conf.aprs_is.beaconTimeout = data["aprs_is"]["beacon_timeout"] | 15;
|
||||
conf.digi.active = data["digi"]["active"] | false;
|
||||
conf.digi.forwardTimeout = data["digi"]["forward_timeout"] | 5;
|
||||
conf.digi.beacon = data["digi"]["beacon"] | true;
|
||||
conf.digi.beaconTimeout = data["digi"]["beacon_timeout"] | 30;
|
||||
|
||||
conf.lora.frequencyRx = data["lora"]["frequency_rx"] | 433775000;
|
||||
conf.lora.frequencyTx = data["lora"]["frequency_tx"] | 433775000;
|
||||
conf.lora.power = data["lora"]["power"] | 20;
|
||||
conf.lora.spreadingFactor = data["lora"]["spreading_factor"] | 12;
|
||||
conf.lora.signalBandwidth = data["lora"]["signal_bandwidth"] | 125000;
|
||||
conf.lora.codingRate4 = data["lora"]["coding_rate4"] | 5;
|
||||
conf.display.alwaysOn = data["display"]["always_on"] | true;
|
||||
conf.display.timeout = data["display"]["timeout"] | 10;
|
||||
conf.display.overwritePin = data["display"]["overwrite_pin"] | 0;
|
||||
|
||||
conf.ftp.active = data["ftp"]["active"] | false;
|
||||
JsonArray users = data["ftp"]["user"].as<JsonArray>();
|
||||
for(JsonVariant u : users)
|
||||
{
|
||||
Configuration::Ftp::User us;
|
||||
us.name = u["name"].as<String>();
|
||||
us.password = u["password"].as<String>();
|
||||
conf.ftp.users.push_back(us);
|
||||
}
|
||||
if(conf.ftp.users.empty())
|
||||
{
|
||||
Configuration::Ftp::User us;
|
||||
us.name = "ftp";
|
||||
us.password = "ftp";
|
||||
conf.ftp.users.push_back(us);
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
void ConfigurationManagement::writeConfiguration(Configuration conf)
|
||||
{
|
||||
File file = SPIFFS.open(mFilePath, "w");
|
||||
if(!file)
|
||||
{
|
||||
logPrintlnE("Failed to open file for writing...");
|
||||
return;
|
||||
}
|
||||
DynamicJsonDocument data(2048);
|
||||
|
||||
data["callsign"] = conf.callsign;
|
||||
data["wifi"]["active"] = conf.wifi.active;
|
||||
JsonArray aps = data["wifi"].createNestedArray("AP");
|
||||
for(Configuration::Wifi::AP ap : conf.wifi.APs)
|
||||
{
|
||||
JsonObject v = aps.createNestedObject();
|
||||
v["SSID"] = ap.SSID;
|
||||
v["password"] = ap.password;
|
||||
}
|
||||
data["beacon"]["message"] = conf.beacon.message;
|
||||
data["smart_beacon"]["active"] = conf.smart_beacon.active;
|
||||
data["smart_beacon"]["turn_min"] = conf.smart_beacon.turn_min;
|
||||
data["smart_beacon"]["slow_rate"] = conf.smart_beacon.slow_rate;
|
||||
data["smart_beacon"]["slow_speed"] = conf.smart_beacon.slow_speed;
|
||||
data["smart_beacon"]["fast_rate"] = conf.smart_beacon.fast_rate;
|
||||
data["smart_beacon"]["fast_speed"] = conf.smart_beacon.fast_speed;
|
||||
data["smart_beacon"]["min_tx_dist"] = conf.smart_beacon.min_tx_dist;
|
||||
data["smart_beacon"]["min_bcn"] = conf.smart_beacon.min_bcn ;
|
||||
|
||||
data["aprs_is"]["active"] = conf.aprs_is.active;
|
||||
data["aprs_is"]["password"] = conf.aprs_is.password;
|
||||
data["aprs_is"]["server"] = conf.aprs_is.server;
|
||||
data["aprs_is"]["port"] = conf.aprs_is.port;
|
||||
data["aprs_is"]["beacon"] = conf.aprs_is.beacon;
|
||||
data["aprs_is"]["beacon_timeout"] = conf.aprs_is.beaconTimeout;
|
||||
data["digi"]["active"] = conf.digi.active;
|
||||
data["digi"]["forward_timeout"] = conf.digi.forwardTimeout;
|
||||
data["digi"]["beacon"] = conf.digi.beacon;
|
||||
data["digi"]["beacon_timeout"] = conf.digi.beaconTimeout;
|
||||
data["lora"]["frequency_rx"] = conf.lora.frequencyRx;
|
||||
data["lora"]["frequency_tx"] = conf.lora.frequencyTx;
|
||||
data["lora"]["power"] = conf.lora.power;
|
||||
data["lora"]["spreading_factor"] = conf.lora.spreadingFactor;
|
||||
data["lora"]["signal_bandwidth"] = conf.lora.signalBandwidth;
|
||||
data["lora"]["coding_rate4"] = conf.lora.codingRate4;
|
||||
data["display"]["always_on"] = conf.display.alwaysOn;
|
||||
data["display"]["timeout"] = conf.display.timeout;
|
||||
data["display"]["overwrite_pin"] = conf.display.overwritePin;
|
||||
data["ftp"]["active"] = conf.ftp.active;
|
||||
JsonArray users = data["ftp"].createNestedArray("user");
|
||||
for(Configuration::Ftp::User u : conf.ftp.users)
|
||||
{
|
||||
JsonObject v = users.createNestedObject();
|
||||
v["name"] = u.name;
|
||||
v["password"] = u.password;
|
||||
}
|
||||
|
||||
serializeJson(data, file);
|
||||
//serializeJson(data, Serial);
|
||||
//Serial.println();
|
||||
file.close();
|
||||
}
|
146
src/configuration.h
Normal file
146
src/configuration.h
Normal file
|
@ -0,0 +1,146 @@
|
|||
#ifndef CONFIGURATION_H_
|
||||
#define CONFIGURATION_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <Arduino.h>
|
||||
#ifndef CPPCHECK
|
||||
#include <ArduinoJson.h>
|
||||
#endif
|
||||
|
||||
class Configuration
|
||||
{
|
||||
public:
|
||||
class Wifi
|
||||
{
|
||||
public:
|
||||
class AP
|
||||
{
|
||||
public:
|
||||
String SSID;
|
||||
String password;
|
||||
};
|
||||
|
||||
Wifi() : active(false) {}
|
||||
|
||||
bool active;
|
||||
std::list<AP> APs;
|
||||
};
|
||||
|
||||
class Beacon
|
||||
{
|
||||
public:
|
||||
Beacon() : message("LoRa Tracker, Info: github.com/peterus/LoRa_APRS_Tracker") {}
|
||||
|
||||
String message;
|
||||
int timeout = 1;
|
||||
String symbol;
|
||||
String overlay;
|
||||
|
||||
};
|
||||
|
||||
class Smart_Beacon
|
||||
{
|
||||
public:
|
||||
Smart_Beacon() : active(true), turn_min(25), slow_rate(300), slow_speed(10), fast_rate(60), fast_speed(100), min_tx_dist(100), min_bcn(5) {}
|
||||
|
||||
bool active;
|
||||
int turn_min;
|
||||
int slow_rate;
|
||||
int slow_speed;
|
||||
int fast_rate;
|
||||
int fast_speed;
|
||||
int min_tx_dist;
|
||||
int min_bcn;
|
||||
};
|
||||
|
||||
class APRS_IS
|
||||
{
|
||||
public:
|
||||
APRS_IS() : active(false), server("euro.aprs2.net"), port(14580), beacon(true), beaconTimeout(15) {}
|
||||
|
||||
bool active;
|
||||
String password;
|
||||
String server;
|
||||
int port;
|
||||
bool beacon;
|
||||
int beaconTimeout;
|
||||
};
|
||||
|
||||
class Digi
|
||||
{
|
||||
public:
|
||||
Digi() : active(false), forwardTimeout(5), beacon(true), beaconTimeout(30) {}
|
||||
|
||||
bool active;
|
||||
int forwardTimeout;
|
||||
bool beacon;
|
||||
int beaconTimeout;
|
||||
};
|
||||
|
||||
class LoRa
|
||||
{
|
||||
public:
|
||||
LoRa() : frequencyRx(433775E3), frequencyTx(433775E3), power(20), spreadingFactor(12), signalBandwidth(125000), codingRate4(5) {}
|
||||
|
||||
long frequencyRx;
|
||||
long frequencyTx;
|
||||
int power;
|
||||
int spreadingFactor;
|
||||
long signalBandwidth;
|
||||
int codingRate4;
|
||||
};
|
||||
|
||||
class Display
|
||||
{
|
||||
public:
|
||||
Display() : alwaysOn(true), timeout(10), overwritePin(0) {}
|
||||
|
||||
bool alwaysOn;
|
||||
int timeout;
|
||||
int overwritePin;
|
||||
};
|
||||
|
||||
class Ftp
|
||||
{
|
||||
public:
|
||||
class User
|
||||
{
|
||||
public:
|
||||
String name;
|
||||
String password;
|
||||
};
|
||||
|
||||
Ftp() : active(false) {}
|
||||
|
||||
bool active;
|
||||
std::list<User> users;
|
||||
};
|
||||
|
||||
Configuration() : callsign("NOCALL-10") {};
|
||||
|
||||
String callsign;
|
||||
Wifi wifi;
|
||||
Beacon beacon;
|
||||
Smart_Beacon smart_beacon;
|
||||
APRS_IS aprs_is;
|
||||
Digi digi;
|
||||
LoRa lora;
|
||||
Display display;
|
||||
Ftp ftp;
|
||||
bool debug;
|
||||
};
|
||||
|
||||
class ConfigurationManagement
|
||||
{
|
||||
public:
|
||||
explicit ConfigurationManagement(String FilePath);
|
||||
|
||||
Configuration readConfiguration();
|
||||
void writeConfiguration(Configuration conf);
|
||||
|
||||
private:
|
||||
const String mFilePath;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -4,7 +4,6 @@
|
|||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "settings.h"
|
||||
#include "pins.h"
|
||||
|
||||
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
|
||||
|
|
248
src/logger.cpp
Normal file
248
src/logger.cpp
Normal file
|
@ -0,0 +1,248 @@
|
|||
#include "logger.h"
|
||||
|
||||
#undef LOG_RESET_COLOR
|
||||
#undef LOG_COLOR_E
|
||||
#undef LOG_COLOR_W
|
||||
#undef LOG_COLOR_I
|
||||
#undef LOG_COLOR_D
|
||||
#undef LOG_COLOR_V
|
||||
|
||||
#define LOG_COLOR_BLACK "30"
|
||||
#define LOG_COLOR_RED "31"
|
||||
#define LOG_COLOR_GREEN "32"
|
||||
#define LOG_COLOR_BROWN "33"
|
||||
#define LOG_COLOR_BLUE "34"
|
||||
#define LOG_COLOR_PURPLE "35"
|
||||
#define LOG_COLOR_CYAN "36"
|
||||
#define LOG_COLOR(COLOR) "\033[0;" COLOR "m"
|
||||
#define LOG_BOLD(COLOR) "\033[1;" COLOR "m"
|
||||
#define LOG_RESET_COLOR "\033[0m"
|
||||
#define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED)
|
||||
#define LOG_COLOR_W LOG_COLOR(LOG_COLOR_BROWN)
|
||||
#define LOG_COLOR_I LOG_COLOR(LOG_COLOR_GREEN)
|
||||
#define LOG_COLOR_D LOG_COLOR(LOG_COLOR_BLUE)
|
||||
#define LOG_COLOR_V LOG_COLOR(LOG_COLOR_CYAN)
|
||||
|
||||
Logger::Logger()
|
||||
: _serial(Serial), _level(DEBUG_LEVEL_DEBUG), _printIsNewline(true)
|
||||
{
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::setSerial(const HardwareSerial & serial)
|
||||
{
|
||||
_serial = serial;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::setDebugLevel(debug_level_t level)
|
||||
{
|
||||
_level = level;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printA(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_NONE);
|
||||
printHeader(DEBUG_LEVEL_NONE, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_NONE);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printE(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_ERROR);
|
||||
printHeader(DEBUG_LEVEL_ERROR, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_ERROR);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnA(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_NONE);
|
||||
printHeader(DEBUG_LEVEL_NONE, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_NONE);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnE(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_ERROR);
|
||||
printHeader(DEBUG_LEVEL_ERROR, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_ERROR);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printV(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_VERBOSE)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_VERBOSE);
|
||||
printHeader(DEBUG_LEVEL_VERBOSE, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printD(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_DEBUG)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_DEBUG);
|
||||
printHeader(DEBUG_LEVEL_DEBUG, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printI(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_INFO)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_INFO);
|
||||
printHeader(DEBUG_LEVEL_INFO, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printW(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_WARN)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_WARN);
|
||||
printHeader(DEBUG_LEVEL_WARN, file, line, false);
|
||||
_serial.print(text);
|
||||
printEndColor(DEBUG_LEVEL_WARN);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnV(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_VERBOSE)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_VERBOSE);
|
||||
printHeader(DEBUG_LEVEL_VERBOSE, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnD(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_DEBUG)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_DEBUG);
|
||||
printHeader(DEBUG_LEVEL_DEBUG, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnI(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_INFO)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_INFO);
|
||||
printHeader(DEBUG_LEVEL_INFO, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Logger::printlnW(const String & text, const char * file, uint32_t line)
|
||||
{
|
||||
if (_level >= DEBUG_LEVEL_WARN)
|
||||
{
|
||||
printStartColor(DEBUG_LEVEL_WARN);
|
||||
printHeader(DEBUG_LEVEL_WARN, file, line, true);
|
||||
_serial.println(text);
|
||||
printEndColor(DEBUG_LEVEL_WARN);
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::printStartColor(debug_level_t level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case DEBUG_LEVEL_ERROR:
|
||||
_serial.print(LOG_COLOR_E);
|
||||
break;
|
||||
case DEBUG_LEVEL_WARN:
|
||||
_serial.print(LOG_COLOR_W);
|
||||
break;
|
||||
case DEBUG_LEVEL_INFO:
|
||||
_serial.print(LOG_COLOR_I);
|
||||
break;
|
||||
case DEBUG_LEVEL_DEBUG:
|
||||
_serial.print(LOG_COLOR_D);
|
||||
break;
|
||||
case DEBUG_LEVEL_VERBOSE:
|
||||
_serial.print(LOG_COLOR_V);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::printHeader(debug_level_t level, const char * file, uint32_t line, bool isln)
|
||||
{
|
||||
if (_printIsNewline)
|
||||
{
|
||||
Serial.printf("%c %25s %4d : ", levelToChar(level), file, line);
|
||||
if(!isln)
|
||||
{
|
||||
_printIsNewline = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_printIsNewline = isln;
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::printEndColor(debug_level_t level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case DEBUG_LEVEL_ERROR:
|
||||
case DEBUG_LEVEL_WARN:
|
||||
case DEBUG_LEVEL_INFO:
|
||||
case DEBUG_LEVEL_DEBUG:
|
||||
case DEBUG_LEVEL_VERBOSE:
|
||||
_serial.print(LOG_RESET_COLOR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char Logger::levelToChar(debug_level_t level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case DEBUG_LEVEL_ERROR:
|
||||
return 'E';
|
||||
case DEBUG_LEVEL_WARN:
|
||||
return 'W';
|
||||
case DEBUG_LEVEL_INFO:
|
||||
return 'I';
|
||||
case DEBUG_LEVEL_DEBUG:
|
||||
return 'D';
|
||||
case DEBUG_LEVEL_VERBOSE:
|
||||
return 'V';
|
||||
default:
|
||||
return ' ';
|
||||
}
|
||||
}
|
75
src/logger.h
Normal file
75
src/logger.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
#ifndef _LOGGER_H_
|
||||
#define _LOGGER_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
enum debug_level_t {
|
||||
DEBUG_LEVEL_NONE, // No debug output
|
||||
DEBUG_LEVEL_ERROR, // Critical errors
|
||||
DEBUG_LEVEL_WARN, // Error conditions but not critical
|
||||
DEBUG_LEVEL_INFO, // Information messages
|
||||
DEBUG_LEVEL_DEBUG, // Extra information - default level (if not changed)
|
||||
DEBUG_LEVEL_VERBOSE, // More information than the usual
|
||||
DEBUG_LEVELS_SIZE
|
||||
};
|
||||
|
||||
static Logger & instance()
|
||||
{
|
||||
static Logger _instance;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
~Logger() {}
|
||||
|
||||
void setSerial(const HardwareSerial & serial = Serial);
|
||||
void setDebugLevel(debug_level_t level);
|
||||
|
||||
// print always:
|
||||
void printA(const String & text, const char * file, uint32_t line); // always
|
||||
void printE(const String & text, const char * file, uint32_t line); // error
|
||||
void printlnA(const String & text, const char * file, uint32_t line); // always with new line
|
||||
void printlnE(const String & text, const char * file, uint32_t line); // error with new line
|
||||
|
||||
// depending on verbose level:
|
||||
void printV(const String & text, const char * file, uint32_t line); // verbose
|
||||
void printD(const String & text, const char * file, uint32_t line); // debug
|
||||
void printI(const String & text, const char * file, uint32_t line); // information
|
||||
void printW(const String & text, const char * file, uint32_t line); // warning
|
||||
|
||||
void printlnV(const String & text, const char * file, uint32_t line); // verbose with new line
|
||||
void printlnD(const String & text, const char * file, uint32_t line); // debug with new line
|
||||
void printlnI(const String & text, const char * file, uint32_t line); // information with new line
|
||||
void printlnW(const String & text, const char * file, uint32_t line); // warning with new line
|
||||
|
||||
private:
|
||||
HardwareSerial & _serial;
|
||||
debug_level_t _level;
|
||||
bool _printIsNewline;
|
||||
|
||||
void printStartColor(debug_level_t level);
|
||||
void printHeader(debug_level_t level, const char * file, uint32_t line, bool isln);
|
||||
void printEndColor(debug_level_t level);
|
||||
char levelToChar(debug_level_t level);
|
||||
|
||||
Logger();
|
||||
Logger(const Logger &);
|
||||
Logger & operator = (const Logger &);
|
||||
};
|
||||
|
||||
#define logPrintA(text) Logger::instance().printA(text, __FILE__, __LINE__)
|
||||
#define logPrintE(text) Logger::instance().printE(text, __FILE__, __LINE__)
|
||||
#define logPrintlnA(text) Logger::instance().printlnA(text, __FILE__, __LINE__)
|
||||
#define logPrintlnE(text) Logger::instance().printlnE(text, __FILE__, __LINE__)
|
||||
#define logPrintV(text) Logger::instance().printV(text, __FILE__, __LINE__)
|
||||
#define logPrintD(text) Logger::instance().printD(text, __FILE__, __LINE__)
|
||||
#define logPrintI(text) Logger::instance().printI(text, __FILE__, __LINE__)
|
||||
#define logPrintW(text) Logger::instance().printW(text, __FILE__, __LINE__)
|
||||
#define logPrintlnV(text) Logger::instance().printlnV(text, __FILE__, __LINE__)
|
||||
#define logPrintlnD(text) Logger::instance().printlnD(text, __FILE__, __LINE__)
|
||||
#define logPrintlnI(text) Logger::instance().printlnI(text, __FILE__, __LINE__)
|
||||
#define logPrintlnW(text) Logger::instance().printlnW(text, __FILE__, __LINE__)
|
||||
|
||||
#endif
|
|
@ -75,13 +75,38 @@ double PowerManagement::getBatteryVoltage()
|
|||
return axp.getBattVoltage() / 1000.0;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
String PowerManagement::getBatteryVoltageStr()
|
||||
{
|
||||
double volts = axp.getBattVoltage() / 1000.0;
|
||||
return String(volts);
|
||||
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
double PowerManagement::getBatteryChargeDischargeCurrent()
|
||||
{
|
||||
|
||||
if(axp.isChargeing())
|
||||
{
|
||||
return axp.getBattChargeCurrent();
|
||||
}
|
||||
return -1.0 * axp.getBattDischargeCurrent();
|
||||
}
|
||||
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
String PowerManagement::getBatteryChargeDischargeCurrentStr()
|
||||
{
|
||||
double amps = 0.0;
|
||||
if(axp.isChargeing())
|
||||
{
|
||||
amps = axp.getBattChargeCurrent();
|
||||
}
|
||||
else
|
||||
{
|
||||
amps = -1.0 * axp.getBattDischargeCurrent();
|
||||
};
|
||||
return String(amps,'\000');
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
double getBatteryVoltage();
|
||||
double getBatteryChargeDischargeCurrent();
|
||||
|
||||
String getBatteryVoltageStr();
|
||||
String getBatteryChargeDischargeCurrentStr();
|
||||
|
||||
private:
|
||||
AXP20X_Class axp;
|
||||
};
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
#ifndef SETTINGS_H_
|
||||
#define SETTINGS_H_
|
||||
|
||||
#define CALL "OE5BPA-7"
|
||||
#define BEACON_MESSAGE "LoRa APRS SB Tracker test"
|
||||
#define BEACON_TIMEOUT 1 // Beacon interval in Minutes. Will be overwritten by SB_ACTIVE
|
||||
#define SYMBOL_CODE ">"
|
||||
#define SYMBOL_OVERLAY "/"
|
||||
|
||||
// Freq and Mode Setup - 2021-02-17 YC1HVZ
|
||||
#define FREQ_SET 433775E3 //set freq in KHz XxxXxxE3 6 digit. E3 is KHz
|
||||
#define SF_SET 12 //Spreading Factor
|
||||
#define CR_SET 5 //Coding Rate
|
||||
#define BW_SET 125E3 //Bandwith -> E3 is khz
|
||||
|
||||
// SMART BEACONING PARAMETERS - 2020-11-22 DJ1AN
|
||||
#define SB_ACTIVE // uncomment to enable Smart Beaconing
|
||||
#define SB_TURN_MIN 25 // enter turn angle for smart direction depending beaconing (default=20)
|
||||
#define SB_SLOW_RATE 300 // slow speed TX rate in s
|
||||
#define SB_SLOW_SPEED 10 // slow speed in km/h
|
||||
#define SB_FAST_RATE 60 // high speed TX rate in s
|
||||
#define SB_FAST_SPEED 100 // fast speed in km/h
|
||||
#define SB_MIN_TX_DIST 100 // minimum Distance between tx in m
|
||||
#define SB_MIN_BCN 5 // minimum SB rate in s
|
||||
|
||||
//#define DEBUGMODE // uncomment to activate Debug Mode. Gets GPS Data over Serial.
|
||||
#endif
|
Loading…
Reference in a new issue