mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 11:17:11 +02:00
parent
455d29a6fa
commit
ca6ebfe0fe
6 changed files with 39 additions and 34 deletions
16
src/app.cpp
16
src/app.cpp
|
@ -152,7 +152,7 @@ void app::regularTickers(void) {
|
|||
//everySec([this]() { mImprov.tickSerial(); }, "impro");
|
||||
#endif
|
||||
|
||||
everySec(std::bind(&HistoryType::tickerSecond, mHistory), "hist");
|
||||
everySec(std::bind(&HistoryType::tickerSecond, &mHistory), "hist");
|
||||
}
|
||||
|
||||
#if defined(ETHERNET)
|
||||
|
@ -241,7 +241,7 @@ void app::tickCalcSunrise(void) {
|
|||
if (mMqttEnabled) {
|
||||
tickSun();
|
||||
nxtTrig = mSunrise + mConfig->sun.offsetSecMorning + 1; // one second safety to trigger correctly
|
||||
onceAt(std::bind(&app::tickSun, this), nxtTrig, "mqSr"); // trigger on sunrise to update 'dis_night_comm'
|
||||
onceAt(std::bind(&app::tickSunrise, this), nxtTrig, "mqSr"); // trigger on sunrise to update 'dis_night_comm'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,6 +291,13 @@ void app::tickSun(void) {
|
|||
once(std::bind(&app::tickSun, this), 1, "mqSun"); // MQTT not connected, retry
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::tickSunrise(void) {
|
||||
// only used and enabled by MQTT (see setup())
|
||||
if (!mMqtt.tickerSun(mSunrise, mSunset, mConfig->sun.offsetSecMorning, mConfig->sun.offsetSecEvening, true))
|
||||
once(std::bind(&app::tickSun, this), 1, "mqSun"); // MQTT not connected, retry
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::tickZeroValues(void) {
|
||||
zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY);
|
||||
|
@ -423,11 +430,8 @@ void app:: zeroIvValues(bool checkAvail, bool skipYieldDay) {
|
|||
changed = true;
|
||||
}
|
||||
|
||||
if(changed) {
|
||||
if(mMqttEnabled && !skipYieldDay)
|
||||
mMqtt.setZeroValuesEnable();
|
||||
if(changed)
|
||||
payloadEventListener(RealTimeRunData_Debug, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue