mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-23 22:06:11 +02:00
* fix #38 current assignment for 4-channel inverters
* added last received timestamp in /hoymiles livedata web page #47 * improved style.css * improved NTP as described in #46
This commit is contained in:
parent
ec6cfba895
commit
8238e90903
9 changed files with 37 additions and 27 deletions
tools/esp8266
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue