Implemented resend of PowerCommand
This commit is contained in:
parent
eec04de044
commit
4031b71d7d
@ -46,6 +46,12 @@ void HoymilesClass::loop()
|
|||||||
iv->resendActivePowerControlRequest(_radio.get());
|
iv->resendActivePowerControlRequest(_radio.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set power status if required
|
||||||
|
if (iv->PowerCommand()->getLastPowerCommandSuccess() == CMD_NOK) {
|
||||||
|
Serial.println(F("Resend PowerCommand"));
|
||||||
|
iv->resendPowerControlRequest(_radio.get());
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch dev info (but first fetch stats)
|
// Fetch dev info (but first fetch stats)
|
||||||
if (iv->Statistics()->getLastUpdate() > 0 && (iv->DevInfo()->getLastUpdateAll() == 0 || iv->DevInfo()->getLastUpdateSimple() == 0)) {
|
if (iv->Statistics()->getLastUpdate() > 0 && (iv->DevInfo()->getLastUpdateAll() == 0 || iv->DevInfo()->getLastUpdateSimple() == 0)) {
|
||||||
Serial.println(F("Request device info"));
|
Serial.println(F("Request device info"));
|
||||||
|
|||||||
@ -115,6 +115,8 @@ bool HM_Abstract::resendActivePowerControlRequest(HoymilesRadio* radio)
|
|||||||
|
|
||||||
bool HM_Abstract::sendPowerControlRequest(HoymilesRadio* radio, bool turnOn)
|
bool HM_Abstract::sendPowerControlRequest(HoymilesRadio* radio, bool turnOn)
|
||||||
{
|
{
|
||||||
|
_powerState = turnOn;
|
||||||
|
|
||||||
PowerControlCommand* cmd = radio->enqueCommand<PowerControlCommand>();
|
PowerControlCommand* cmd = radio->enqueCommand<PowerControlCommand>();
|
||||||
cmd->setPowerOn(turnOn);
|
cmd->setPowerOn(turnOn);
|
||||||
cmd->setTargetAddress(serial());
|
cmd->setTargetAddress(serial());
|
||||||
@ -122,3 +124,8 @@ bool HM_Abstract::sendPowerControlRequest(HoymilesRadio* radio, bool turnOn)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HM_Abstract::resendPowerControlRequest(HoymilesRadio* radio)
|
||||||
|
{
|
||||||
|
return sendPowerControlRequest(radio, _powerState);
|
||||||
|
}
|
||||||
@ -12,9 +12,12 @@ public:
|
|||||||
bool sendActivePowerControlRequest(HoymilesRadio* radio, float limit, PowerLimitControlType type);
|
bool sendActivePowerControlRequest(HoymilesRadio* radio, float limit, PowerLimitControlType type);
|
||||||
bool resendActivePowerControlRequest(HoymilesRadio* radio);
|
bool resendActivePowerControlRequest(HoymilesRadio* radio);
|
||||||
bool sendPowerControlRequest(HoymilesRadio* radio, bool turnOn);
|
bool sendPowerControlRequest(HoymilesRadio* radio, bool turnOn);
|
||||||
|
bool resendPowerControlRequest(HoymilesRadio* radio);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _lastAlarmLogCnt = 0;
|
uint8_t _lastAlarmLogCnt = 0;
|
||||||
float _activePowerControlLimit = 0;
|
float _activePowerControlLimit = 0;
|
||||||
PowerLimitControlType _activePowerControlType = PowerLimitControlType::AbsolutNonPersistent;
|
PowerLimitControlType _activePowerControlType = PowerLimitControlType::AbsolutNonPersistent;
|
||||||
|
|
||||||
|
bool _powerState = true;
|
||||||
};
|
};
|
||||||
@ -53,6 +53,7 @@ public:
|
|||||||
virtual bool sendActivePowerControlRequest(HoymilesRadio* radio, float limit, PowerLimitControlType type) = 0;
|
virtual bool sendActivePowerControlRequest(HoymilesRadio* radio, float limit, PowerLimitControlType type) = 0;
|
||||||
virtual bool resendActivePowerControlRequest(HoymilesRadio* radio) = 0;
|
virtual bool resendActivePowerControlRequest(HoymilesRadio* radio) = 0;
|
||||||
virtual bool sendPowerControlRequest(HoymilesRadio* radio, bool turnOn) = 0;
|
virtual bool sendPowerControlRequest(HoymilesRadio* radio, bool turnOn) = 0;
|
||||||
|
virtual bool resendPowerControlRequest(HoymilesRadio* radio) = 0;
|
||||||
|
|
||||||
AlarmLogParser* EventLog();
|
AlarmLogParser* EventLog();
|
||||||
DevInfoParser* DevInfo();
|
DevInfoParser* DevInfo();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user