added login / logout

prepared static IP storage and disable inverter
IMPORTANT: new memory layout, your inverter settings will be lost
This commit is contained in:
lumapu 2022-11-02 22:41:31 +01:00
parent 56b8096bed
commit 6a6d522d3b
11 changed files with 290 additions and 31 deletions

View file

@ -44,6 +44,9 @@ void app::setup(uint32_t timeout) {
mWebInst = new web(this, &mSysConfig, &mConfig, &mStat, mVersion);
mWebInst->setup();
mWebInst->setProtection(strlen(mConfig.password) != 0);
DPRINTLN(DBG_INFO, F("Settings valid: ") + String((mSettingsValid) ? F("true") : F("false")));
DPRINTLN(DBG_INFO, F("EEprom storage size: 0x") + String(ADDR_SETTINGS_CRC, HEX));
}
//-----------------------------------------------------------------------------
@ -58,6 +61,13 @@ void app::loop(void) {
mUptimeSecs++;
if (0 != mUtcTimestamp)
mUtcTimestamp++;
mWebInst->tickSecond();
if (mShouldReboot) {
DPRINTLN(DBG_INFO, F("Rebooting..."));
ESP.restart();
}
}
if (checkTicker(&mNtpRefreshTicker, mNtpRefreshInterval)) {
@ -76,11 +86,6 @@ void app::loop(void) {
sendMqttDiscoveryConfig();
}
if (mShouldReboot) {
DPRINTLN(DBG_INFO, F("Rebooting..."));
ESP.restart();
}
mSys->Radio.loop();
yield();
@ -743,6 +748,9 @@ void app::loadDefaultConfig(void) {
snprintf(mSysConfig.stationSsid, SSID_LEN, "%s", FB_WIFI_SSID);
snprintf(mSysConfig.stationPwd, PWD_LEN, "%s", FB_WIFI_PWD);
// password
snprintf(mConfig.password, PWD_LEN, "%s", GUI_DEF_PASSWORD);
// nrf24
mConfig.sendInterval = SEND_INTERVAL;
mConfig.maxRetransPerPyld = DEF_MAX_RETRANS_PER_PYLD;