diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp
index 21c1ef60..5987a320 100644
--- a/tools/esp8266/app.cpp
+++ b/tools/esp8266/app.cpp
@@ -44,8 +44,6 @@ void app::setup(uint32_t timeout) {
mWebInst = new web(this, &mSysConfig, &mConfig, &mStat, mVersion);
mWebInst->setup();
-
- mSun.setLocalization(52.6479, 13.6922); // ToDo: add lan/lon to setup, can also in app::loadEEpconfig or somewhere else in app.cpp
}
//-----------------------------------------------------------------------------
@@ -206,8 +204,7 @@ void app::loop(void) {
if(++mSendTicker >= mConfig.sendInterval) {
mSendTicker = 0;
- bool DisableNightCommunication = false; // ToDo: Add option in setup to disable inverter communication at night
- if(mUtcTimestamp > 946684800 && (!DisableNightCommunication || !mLatestSunTimestamp || (mTimestamp >= mSunrise && mTimestamp <= mSunset))) { // Timestamp is set and (inverter communication only during the day if the option is activated and sunrise/sunset is set)
+ if(mUtcTimestamp > 946684800 && (!mConfig.sunDisNightCom || !mLatestSunTimestamp || (mTimestamp >= mSunrise && mTimestamp <= mSunset))) { // Timestamp is set and (inverter communication only during the day if the option is activated and sunrise/sunset is set)
if(mConfig.serialDebug)
DPRINTLN(DBG_DEBUG, F("Free heap: 0x") + String(ESP.getFreeHeap(), HEX));
@@ -746,9 +743,9 @@ void app::loadDefaultConfig(void) {
mConfig.ntpPort = DEF_NTP_PORT;
// Latitude + Longitude
- mConfig.lat = 0;
- mConfig.lon = 0;
- mConfig.disnightcom = false; // disable night communication
+ mConfig.sunLat = 0.0;
+ mConfig.sunLon = 0.0;
+ mConfig.sunDisNightCom = false;
// mqtt
snprintf(mConfig.mqtt.broker, MQTT_ADDR_LEN, "%s", DEF_MQTT_BROKER);
@@ -803,6 +800,9 @@ void app::loadEEpconfig(void) {
if(NULL != iv)
resetPayload(iv);
}
+
+ // load sun localization
+ mSun.setLocalization(mConfig.sunLat, mConfig.sunLon);
}
}
@@ -826,6 +826,10 @@ void app::saveValues(void) {
}
updateCrc();
+
+ // update sun localization
+ mSun.setLocalization(mConfig.sunLat, mConfig.sunLon);
+ mLatestSunTimestamp = 0;
}
diff --git a/tools/esp8266/defines.h b/tools/esp8266/defines.h
index aa61d193..c5c21f98 100644
--- a/tools/esp8266/defines.h
+++ b/tools/esp8266/defines.h
@@ -131,10 +131,10 @@ typedef struct {
// mqtt
mqttConfig_t mqtt;
- // Latitude + Longitude
- float lat;
- float lon;
- bool disnightcom;
+ // sun
+ float sunLat;
+ float sunLon;
+ bool sunDisNightCom; // disable night communication
// serial
uint16_t serialInterval;
@@ -153,7 +153,7 @@ typedef struct {
#define CFG_MQTT_LEN MQTT_ADDR_LEN + 2 + MQTT_USER_LEN + MQTT_PWD_LEN +MQTT_TOPIC_LEN
#define CFG_SYS_LEN DEVNAME_LEN + SSID_LEN + PWD_LEN + 1
-#define CFG_LEN 7 + NTP_ADDR_LEN + 2 + CFG_MQTT_LEN + (4 + 4 + 1) + 4 // in the brackets its needed for lon+lat+bool
+#define CFG_LEN 7 + NTP_ADDR_LEN + 2 + CFG_MQTT_LEN + 9 + 4
#define ADDR_START 0
#define ADDR_CFG_SYS ADDR_START
diff --git a/tools/esp8266/html/index.html b/tools/esp8266/html/index.html
index 759e4309..048e85d1 100644
--- a/tools/esp8266/html/index.html
+++ b/tools/esp8266/html/index.html
@@ -13,6 +13,7 @@
Visualization
Setup
+
Webserial & Commands
Uptime:
diff --git a/tools/esp8266/html/setup.html b/tools/esp8266/html/setup.html index 651c93ac..7e7de2be 100644 --- a/tools/esp8266/html/setup.html +++ b/tools/esp8266/html/setup.html @@ -75,16 +75,13 @@