implement retry for keyturner state
This commit is contained in:
@@ -267,7 +267,18 @@ void NukiOpenerWrapper::unpair()
|
|||||||
|
|
||||||
void NukiOpenerWrapper::updateKeyTurnerState()
|
void NukiOpenerWrapper::updateKeyTurnerState()
|
||||||
{
|
{
|
||||||
_nukiOpener.requestOpenerState(&_keyTurnerState);
|
Nuki::CmdResult result =_nukiOpener.requestOpenerState(&_keyTurnerState);
|
||||||
|
if(result != Nuki::CmdResult::Success)
|
||||||
|
{
|
||||||
|
_retryLockstateCount++;
|
||||||
|
postponeBleWatchdog();
|
||||||
|
if(_retryLockstateCount < _nrOfRetries)
|
||||||
|
{
|
||||||
|
_nextLockStateUpdateTs = millis() + _retryDelay;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_retryLockstateCount = 0;
|
||||||
|
|
||||||
if(_statusUpdated &&
|
if(_statusUpdated &&
|
||||||
_keyTurnerState.lockState == NukiOpener::LockState::Locked &&
|
_keyTurnerState.lockState == NukiOpener::LockState::Locked &&
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ private:
|
|||||||
int _nrOfRetries = 0;
|
int _nrOfRetries = 0;
|
||||||
int _retryDelay = 0;
|
int _retryDelay = 0;
|
||||||
int _retryCount = 0;
|
int _retryCount = 0;
|
||||||
|
int _retryLockstateCount = 0;
|
||||||
unsigned long _nextRetryTs = 0;
|
unsigned long _nextRetryTs = 0;
|
||||||
std::vector<uint16_t> _keypadCodeIds;
|
std::vector<uint16_t> _keypadCodeIds;
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,19 @@ void NukiWrapper::unpair()
|
|||||||
|
|
||||||
void NukiWrapper::updateKeyTurnerState()
|
void NukiWrapper::updateKeyTurnerState()
|
||||||
{
|
{
|
||||||
_nukiLock.requestKeyTurnerState(&_keyTurnerState);
|
Nuki::CmdResult result =_nukiLock.requestKeyTurnerState(&_keyTurnerState);
|
||||||
|
if(result != Nuki::CmdResult::Success)
|
||||||
|
{
|
||||||
|
_retryLockstateCount++;
|
||||||
|
postponeBleWatchdog();
|
||||||
|
if(_retryLockstateCount < _nrOfRetries)
|
||||||
|
{
|
||||||
|
_nextLockStateUpdateTs = millis() + _retryDelay;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_retryLockstateCount = 0;
|
||||||
|
|
||||||
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
||||||
|
|
||||||
if(_keyTurnerState.lockState != _lastKeyTurnerState.lockState)
|
if(_keyTurnerState.lockState != _lastKeyTurnerState.lockState)
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ private:
|
|||||||
int _nrOfRetries = 0;
|
int _nrOfRetries = 0;
|
||||||
int _retryDelay = 0;
|
int _retryDelay = 0;
|
||||||
int _retryCount = 0;
|
int _retryCount = 0;
|
||||||
|
int _retryLockstateCount = 0;
|
||||||
long _rssiPublishInterval = 0;
|
long _rssiPublishInterval = 0;
|
||||||
unsigned long _nextRetryTs = 0;
|
unsigned long _nextRetryTs = 0;
|
||||||
unsigned long _nextLockStateUpdateTs = 0;
|
unsigned long _nextLockStateUpdateTs = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user