mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-17 02:34:47 +01:00
added configuration safe rutine
This commit is contained in:
parent
af0626de82
commit
7d5d36b4fa
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"callsign": "CD2RXU-11",
|
||||
"callsign": "CD2RXU-10",
|
||||
"stationMode": 2,
|
||||
"iGateComment": "LoRa_APRS_iGate",
|
||||
"wifi": {
|
||||
"AP": [
|
||||
{ "ssid": "Richon",
|
||||
"password": "k4fPnmg5qnyf",
|
||||
"latitude": -33.0468601,
|
||||
"longitude": -71.6270988
|
||||
"latitude": -33.0337313,
|
||||
"longitude": -71.5737261
|
||||
},
|
||||
{ "ssid": "Jimenita",
|
||||
"password": "mg6wyMhqRnxk",
|
||||
|
|
@ -38,7 +38,8 @@
|
|||
},
|
||||
"display": {
|
||||
"alwaysOn": true,
|
||||
"timeout": 4
|
||||
"timeout": 4,
|
||||
"turn180" : false
|
||||
},
|
||||
"syslog": {
|
||||
"active": false,
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
|||
callsign = data["callsign"].as<String>();
|
||||
stationMode = data["stationMode"].as<int>();
|
||||
iGateComment = data["iGateComment"].as<String>();
|
||||
beaconInterval = data["other"]["beaconInterval"].as<int>();
|
||||
rememberStationTime = data["other"]["rememberStationTime"].as<int>();
|
||||
beaconInterval = data["other"]["beaconInterval"].as<int>() | 15;
|
||||
rememberStationTime = data["other"]["rememberStationTime"].as<int>() | 30;
|
||||
|
||||
digi.comment = data["digi"]["comment"].as<String>();
|
||||
digi.latitude = data["digi"]["latitude"].as<double>();
|
||||
|
|
@ -43,25 +43,26 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
|||
|
||||
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.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>();
|
||||
aprs_is.port = data["aprs_is"]["port"].as<int>() | 14580;
|
||||
aprs_is.reportingDistance = data["aprs_is"]["reportingDistance"].as<int>() | 30;
|
||||
|
||||
loramodule.iGateFreq = data["lora"]["iGateFreq"].as<long>();
|
||||
loramodule.digirepeaterTxFreq = data["lora"]["digirepeaterTxFreq"].as<long>();
|
||||
loramodule.digirepeaterRxFreq = data["lora"]["digirepeaterRxFreq"].as<long>();
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
||||
loramodule.power = data["lora"]["power"].as<int>();
|
||||
loramodule.iGateFreq = data["lora"]["iGateFreq"].as<long>() | 433775000;
|
||||
loramodule.digirepeaterTxFreq = data["lora"]["digirepeaterTxFreq"].as<long>() | 433775000;
|
||||
loramodule.digirepeaterRxFreq = data["lora"]["digirepeaterRxFreq"].as<long>() | 433900000;
|
||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>() | 12;
|
||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>() | 125000;
|
||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>() | 5;
|
||||
loramodule.power = data["lora"]["power"].as<int>() | 20;
|
||||
|
||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>();
|
||||
display.timeout = data["display"]["timeout"].as<int>();
|
||||
display.alwaysOn = data["display"]["alwaysOn"].as<bool>() | true;
|
||||
display.timeout = data["display"]["timeout"].as<int>() | 4;
|
||||
display.turn180 = data["display"]["turn180"].as<bool>() | false;
|
||||
|
||||
syslog.active = data["syslog"]["active"].as<bool>();
|
||||
syslog.active = data["syslog"]["active"].as<bool>() | false;
|
||||
syslog.server = data["syslog"]["server"].as<String>();
|
||||
syslog.port = data["syslog"]["port"].as<int>();
|
||||
|
||||
bme.active = data["bme"]["active"].as<bool>();
|
||||
bme.active = data["bme"]["active"].as<bool>() | false;
|
||||
|
||||
configFile.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class Display {
|
|||
public:
|
||||
bool alwaysOn;
|
||||
int timeout;
|
||||
bool turn180;
|
||||
};
|
||||
|
||||
class SYSLOG {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#include <Adafruit_SSD1306.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Wire.h>
|
||||
#include "configuration.h"
|
||||
#include "pins_config.h"
|
||||
#include "display.h"
|
||||
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
|
||||
extern Configuration Config;
|
||||
|
||||
void setup_display() {
|
||||
Wire.begin(OLED_SDA, OLED_SCL);
|
||||
|
||||
|
|
@ -13,7 +16,9 @@ void setup_display() {
|
|||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
|
||||
if (Config.display.turn180) {
|
||||
display.setRotation(2);
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setTextColor(WHITE);
|
||||
display.setTextSize(1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue