ensure only one PowerCommand and ActivePowerCommand is queued

neither a PowerCommand nor an ActivePowerCommand shall be enqueued if
another one is already pending.
This commit is contained in:
Bernhard Kirchen 2023-06-27 22:01:39 +02:00
parent 8433820529
commit 8b23324693

View File

@ -121,6 +121,10 @@ bool HM_Abstract::sendActivePowerControlRequest(float limit, PowerLimitControlTy
return false;
}
if (CMD_PENDING == SystemConfigPara()->getLastLimitCommandSuccess()) {
return false;
}
if (type == PowerLimitControlType::RelativNonPersistent || type == PowerLimitControlType::RelativPersistent) {
limit = min<float>(100, limit);
}
@ -147,6 +151,10 @@ bool HM_Abstract::sendPowerControlRequest(bool turnOn)
return false;
}
if (CMD_PENDING == PowerCommand()->getLastPowerCommandSuccess()) {
return false;
}
if (turnOn) {
_powerState = 1;
} else {