1
0
Fork 0
mirror of https://github.com/lumapu/ahoy.git synced 2025-05-23 22:06:11 +02:00

* fix current assignment for 4-channel inverters

* added last received timestamp in /hoymiles livedata web page 
* improved style.css
* improved NTP as described in 
This commit is contained in:
lumapu 2022-05-19 16:52:21 +02:00
parent ec6cfba895
commit 8238e90903
9 changed files with 37 additions and 27 deletions
tools/esp8266

View file

@ -30,6 +30,8 @@ Main::Main(void) {
mUptimeSecs = 0;
mUptimeTicker = 0xffffffff;
mUptimeInterval = 1000;
mTimestamp = 0;
}
@ -56,12 +58,6 @@ void Main::setup(uint32_t timeout) {
setupAp(WIFI_AP_SSID, WIFI_AP_PWD);
#endif
if(!startAp) {
delay(5000);
mTimestamp = getNtpTime();
DPRINTLN("[NTP]: " + getDateTimeStr(getNtpTime()));
}
mUpdater->setup(mWeb);
mApActive = startAp;
}
@ -98,7 +94,14 @@ void Main::loop(void) {
if(checkTicker(&mUptimeTicker, mUptimeInterval)) {
mUptimeSecs++;
mTimestamp++;
if(0 != mTimestamp)
mTimestamp++;
else {
if(!mApActive) {
mTimestamp = getNtpTime();
DPRINTLN("[NTP]: " + getDateTimeStr(getNtpTime()));
}
}
}
}
@ -414,7 +417,7 @@ void Main::sendNTPpacket(IPAddress& address) {
//-----------------------------------------------------------------------------
String Main::getDateTimeStr(time_t t) {
char str[20] = {0};
sprintf(str, "%04d-%02d-%02d+%02d:%02d:%02d", year(t), month(t), day(t), hour(t), minute(t), second(t));
sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d", year(t), month(t), day(t), hour(t), minute(t), second(t));
return String(str);
}