|
@ -164,6 +164,7 @@ void app::tickNtpUpdate(void) { |
|
|
mMqttReconnect = false; |
|
|
mMqttReconnect = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(mConfig->inst.rstValsNotAvail) |
|
|
everyMin(std::bind(&app::tickMinute, this), "tMin"); |
|
|
everyMin(std::bind(&app::tickMinute, this), "tMin"); |
|
|
if(mConfig->inst.rstYieldMidNight) { |
|
|
if(mConfig->inst.rstYieldMidNight) { |
|
|
uint32_t midTrig = mTimestamp - ((mTimestamp - 1) % 86400) + 86400; // next midnight
|
|
|
uint32_t midTrig = mTimestamp - ((mTimestamp - 1) % 86400) + 86400; // next midnight
|
|
@ -176,6 +177,12 @@ void app::tickNtpUpdate(void) { |
|
|
mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600; |
|
|
mCalculatedTimezoneOffset = (int8_t)((mConfig->sun.lon >= 0 ? mConfig->sun.lon + 7.5 : mConfig->sun.lon - 7.5) / 15) * 3600; |
|
|
tickCalcSunrise(); |
|
|
tickCalcSunrise(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// immediately start communicating
|
|
|
|
|
|
if(isOK && mSendFirst) { |
|
|
|
|
|
mSendFirst = false; |
|
|
|
|
|
once(std::bind(&app::tickSend, this), 2, "senOn"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
once(std::bind(&app::tickNtpUpdate, this), nxtTrig, "ntp"); |
|
|
once(std::bind(&app::tickNtpUpdate, this), nxtTrig, "ntp"); |
|
|
} |
|
|
} |
|
@ -246,7 +253,8 @@ void app::tickComm(void) { |
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
void app::tickMinute(void) { |
|
|
void app::tickMinute(void) { |
|
|
if(mConfig->inst.rstValsNotAvail) { |
|
|
// only triggered if 'reset values on no avail is enabled'
|
|
|
|
|
|
|
|
|
Inverter<> *iv; |
|
|
Inverter<> *iv; |
|
|
// set values to zero, except yields
|
|
|
// set values to zero, except yields
|
|
|
for (uint8_t id = 0; id < mSys.getNumInverters(); id++) { |
|
|
for (uint8_t id = 0; id < mSys.getNumInverters(); id++) { |
|
@ -257,7 +265,6 @@ void app::tickMinute(void) { |
|
|
if(!iv->isAvailable(mTimestamp) && !iv->isProducing(mTimestamp) && iv->config->enabled) |
|
|
if(!iv->isAvailable(mTimestamp) && !iv->isProducing(mTimestamp) && iv->config->enabled) |
|
|
mPayload.zeroInverterValues(iv); |
|
|
mPayload.zeroInverterValues(iv); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
@ -325,6 +332,8 @@ void app::resetSystem(void) { |
|
|
mTimestamp = 1; |
|
|
mTimestamp = 1; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
mSendFirst = true; |
|
|
|
|
|
|
|
|
mSunrise = 0; |
|
|
mSunrise = 0; |
|
|
mSunset = 0; |
|
|
mSunset = 0; |
|
|
|
|
|
|
|
|