fix: Make sure limit values sre consistent and not above 100%
Ref: https://github.com/tbnobody/OpenDTU/issues/25
This commit is contained in:
parent
653efb41a2
commit
f01dd7c4bf
@ -47,7 +47,11 @@ float SystemConfigParaParser::getLimitPercent() const
|
|||||||
HOY_SEMAPHORE_TAKE();
|
HOY_SEMAPHORE_TAKE();
|
||||||
const float ret = ((static_cast<uint16_t>(_payload[2]) << 8) | _payload[3]) / 10.0;
|
const float ret = ((static_cast<uint16_t>(_payload[2]) << 8) | _payload[3]) / 10.0;
|
||||||
HOY_SEMAPHORE_GIVE();
|
HOY_SEMAPHORE_GIVE();
|
||||||
return ret;
|
|
||||||
|
// don't pretend the inverter could produce more than its rated power,
|
||||||
|
// even though it does process, accept, and even save limit values beyond
|
||||||
|
// its rated power.
|
||||||
|
return min<float>(100, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLimitPercent(const float value)
|
void SystemConfigParaParser::setLimitPercent(const float value)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user