fixing configuration issue and adding more printouts

pull/12/head
Peter Buchegger 2020-11-03 23:34:36 +01:00
rodzic 7f5a0d8846
commit 88ff8f4c53
3 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -94,7 +94,7 @@ void setup()
}
delay(500);
Serial.println("setup done...");
Serial.println("[INFO] setup done...");
secondsSinceDisplay = 0;
}
@ -296,6 +296,7 @@ void load_config()
{
Config.display.overwritePin = KEY_BUILTIN;
}
Serial.println("[INFO] Configuration loaded!");
}
void setup_wifi()
@ -304,6 +305,8 @@ void setup_wifi()
WiFi.setHostname(Config.callsign.c_str());
for(Configuration::Wifi::AP ap : Config.wifi.APs)
{
Serial.print("[INFO] Looking for AP: ");
Serial.println(ap.SSID);
WiFiMulti.addAP(ap.SSID.c_str(), ap.password.c_str());
}
Serial.print("[INFO] Waiting for WiFi");
@ -358,6 +361,7 @@ void setup_ota()
});
ArduinoOTA.setHostname(Config.callsign.c_str());
ArduinoOTA.begin();
Serial.println("[INFO] OTA init done!");
}
void setup_lora()

Wyświetl plik

@ -76,6 +76,9 @@ Configuration ConfigurationManagement::readConfiguration()
conf.lora.codingRate4 = data["lora"]["coding_rate4"];
}
// update config in memory to get the new fields:
writeConfiguration(conf);
return conf;
}
@ -92,13 +95,12 @@ void ConfigurationManagement::writeConfiguration(Configuration conf)
data["version"] = conf.version;
data["callsign"] = conf.callsign;
data["wifi"]["active"] = conf.wifi.active;
JsonArray aps = data["wifi"]["AP"].to<JsonArray>();
JsonArray aps = data["wifi"].createNestedArray("AP");
for(Configuration::Wifi::AP ap : conf.wifi.APs)
{
JsonVariant v;
JsonObject v = aps.createNestedObject();
v["SSID"] = ap.SSID;
v["password"] = ap.password;
aps.add(v);
}
data["beacon"]["message"] = conf.beacon.message;
data["beacon"]["position"]["latitude"] = conf.beacon.positionLatitude;
@ -124,7 +126,7 @@ void ConfigurationManagement::writeConfiguration(Configuration conf)
data["display"]["overwrite_pin"] = conf.display.overwritePin;
serializeJson(data, file);
serializeJson(data, Serial);
Serial.println();
//serializeJson(data, Serial);
//Serial.println();
file.close();
}

Wyświetl plik

@ -82,7 +82,7 @@ public:
int overwritePin;
};
Configuration() : version(2), callsign("NOCALL-10") {};
Configuration() : version(3), callsign("NOCALL-10") {};
int version;
String callsign;