Feature: Turn off LED 1 if no inverters are enabled for polling
This means that e.g. at night, when polling at night is disabled, LED 1 will be turned off now.
This commit is contained in:
parent
0ffbba0cf5
commit
fe3d6588bc
@ -50,6 +50,9 @@ public:
|
||||
// True if at least one inverter is producing
|
||||
bool getIsAtLeastOneProducing();
|
||||
|
||||
// True if at least one inverter is enabled for polling
|
||||
bool getIsAtLeastOnePollEnabled();
|
||||
|
||||
// True if all enabled inverters are producing
|
||||
bool getIsAllEnabledProducing();
|
||||
|
||||
@ -75,6 +78,7 @@ private:
|
||||
bool _isAtLeastOneProducing = false;
|
||||
bool _isAllEnabledProducing = false;
|
||||
bool _isAllEnabledReachable = false;
|
||||
bool _isAtLeastOnePollEnabled = false;
|
||||
};
|
||||
|
||||
extern DatastoreClass Datastore;
|
||||
@ -30,6 +30,7 @@ void DatastoreClass::loop()
|
||||
|
||||
uint8_t isProducing = 0;
|
||||
uint8_t isReachable = 0;
|
||||
uint8_t pollEnabledCount = 0;
|
||||
|
||||
DAT_SEMAPHORE_TAKE();
|
||||
|
||||
@ -62,6 +63,10 @@ void DatastoreClass::loop()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inv->getEnablePolling()) {
|
||||
pollEnabledCount++;
|
||||
}
|
||||
|
||||
if (inv->isProducing()) {
|
||||
isProducing++;
|
||||
} else {
|
||||
@ -107,6 +112,7 @@ void DatastoreClass::loop()
|
||||
|
||||
_isAtLeastOneProducing = isProducing > 0;
|
||||
_isAtLeastOneReachable = isReachable > 0;
|
||||
_isAtLeastOnePollEnabled = pollEnabledCount > 0;
|
||||
|
||||
_totalDcIrradiation = _totalDcIrradiationInstalled > 0 ? _totalDcPowerIrradiation / _totalDcIrradiationInstalled * 100.0f : 0;
|
||||
|
||||
@ -235,3 +241,11 @@ bool DatastoreClass::getIsAllEnabledReachable()
|
||||
DAT_SEMAPHORE_GIVE();
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool DatastoreClass::getIsAtLeastOnePollEnabled()
|
||||
{
|
||||
DAT_SEMAPHORE_TAKE();
|
||||
bool retval = _isAtLeastOnePollEnabled;
|
||||
DAT_SEMAPHORE_GIVE();
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ void LedSingleClass::loop()
|
||||
|
||||
// Update inverter status
|
||||
_ledState[1] = LedState_t::Off;
|
||||
if (Hoymiles.getNumInverters()) {
|
||||
if (Hoymiles.getNumInverters() && Datastore.getIsAtLeastOnePollEnabled()) {
|
||||
// set LED status
|
||||
if (Datastore.getIsAllEnabledReachable() && Datastore.getIsAllEnabledProducing()) {
|
||||
_ledState[1] = LedState_t::On;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user