mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-07-13 21:31:14 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c80b565730 | |||
| 84cbcc30e8 | |||
| 11d413cb17 | |||
| 19d767e3cb | |||
| 803bde1008 | |||
| 35760b74f7 |
@@ -195,13 +195,13 @@ public:
|
||||
REMOTE_MANAGEMENT remoteManagement;
|
||||
MQTT mqtt;
|
||||
|
||||
void setup();
|
||||
void setDefaultValues();
|
||||
bool writeFile();
|
||||
Configuration();
|
||||
|
||||
private:
|
||||
bool readFile();
|
||||
String _filePath;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -68,7 +68,7 @@ ___________________________________________________________________*/
|
||||
|
||||
|
||||
String versionDate = "2026-03-08";
|
||||
String versionNumber = "3.3";
|
||||
String versionNumber = "3.2.101";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
WiFiClient mqttClient;
|
||||
@@ -101,6 +101,7 @@ String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seven
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Config.setup();
|
||||
POWER_Utils::setup();
|
||||
Utils::setupDisplay();
|
||||
LoRa_Utils::setup();
|
||||
@@ -216,4 +217,4 @@ void loop() {
|
||||
Utils::checkRebootTime();
|
||||
Utils::checkSleepByLowBatteryVoltage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-20
@@ -25,11 +25,29 @@
|
||||
|
||||
bool shouldSleepStop = true;
|
||||
|
||||
void Configuration::setup() {
|
||||
if (!SPIFFS.begin(false)) {
|
||||
Serial.println("SPIFFS Mount Failed");
|
||||
return;
|
||||
} else {
|
||||
Serial.println("SPIFFS Mounted");
|
||||
}
|
||||
|
||||
bool exists = SPIFFS.exists("/igate_conf.json");
|
||||
if (!exists) {
|
||||
setDefaultValues();
|
||||
writeFile();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
readFile();
|
||||
}
|
||||
|
||||
bool Configuration::writeFile() {
|
||||
Serial.println("Saving configuration...");
|
||||
|
||||
StaticJsonDocument<3584> data;
|
||||
DynamicJsonDocument data(3584);
|
||||
File configFile = SPIFFS.open("/igate_conf.json", "w");
|
||||
|
||||
if (!configFile) {
|
||||
@@ -558,22 +576,3 @@ void Configuration::setDefaultValues() {
|
||||
|
||||
Serial.println("New Data Created... All is Written!");
|
||||
}
|
||||
|
||||
Configuration::Configuration() {
|
||||
if (!SPIFFS.begin(false)) {
|
||||
Serial.println("SPIFFS Mount Failed");
|
||||
return;
|
||||
} else {
|
||||
Serial.println("SPIFFS Mounted");
|
||||
}
|
||||
|
||||
bool exists = SPIFFS.exists("/igate_conf.json");
|
||||
if (!exists) {
|
||||
setDefaultValues();
|
||||
writeFile();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
readFile();
|
||||
}
|
||||
Reference in New Issue
Block a user