#54 add possibility to check if the basic setup is finished

pull/1/head
Thomas Ballmann 3 years ago
parent fb23a17ae0
commit 59322547e0

@ -43,7 +43,7 @@
Promise.all([this.loadStats(), this.loadSettings()]).then(() => {
// init app
let goto
const setupFinished = true // TODO
const setupFinished = this.stats.device.configured
const wifiConnected = this.stats.wifi.connected
// only on initial navigation

@ -122,6 +122,7 @@ void setupApp()
doc["device"]["hostname"] = WiFi.getHostname();
doc["device"]["runtime"] = ceil(millis() / 1000);
doc["device"]["bootCycle"] = deviceGetBootCount();
doc["device"]["configured"] = deviceIsConfigured();
doc["device"]["screen"]["width"] = displayGetWidth();
doc["device"]["screen"]["height"] = displayGetHeight();

@ -12,7 +12,6 @@ char DeviceId[21 + 1];
void sleepDevice();
bool isBootTimeOver();
void setupDevice()
{
// increment boot number and print it every reboot
@ -52,6 +51,11 @@ unsigned int deviceGetBootCount()
return bootCount;
}
bool deviceIsConfigured()
{
return !(NVS.getString("wifi.ssid").isEmpty() || NVS.getString("device.name").isEmpty() || NVS.getString("device.theme").isEmpty());
}
bool isBootTimeOver()
{
return millis() - bootTime >= 60000;

@ -12,6 +12,7 @@ void loopDevice();
void deviceSetSleepInterval(long interval);
long deviceGetSleepInterval();
unsigned int deviceGetBootCount();
bool deviceIsConfigured();
extern char DeviceId[21 +1];

Loading…
Cancel
Save