move watchdog reset into retry wrapper loop
This commit is contained in:
@@ -302,12 +302,6 @@ void NukiOpenerWrapper::update()
|
|||||||
if(cmdResult != Nuki::CmdResult::Success)
|
if(cmdResult != Nuki::CmdResult::Success)
|
||||||
{
|
{
|
||||||
_network->publishRetry(std::to_string(retryCount + 1));
|
_network->publishRetry(std::to_string(retryCount + 1));
|
||||||
|
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
++retryCount;
|
++retryCount;
|
||||||
}
|
}
|
||||||
postponeBleWatchdog();
|
postponeBleWatchdog();
|
||||||
@@ -612,12 +606,7 @@ void NukiOpenerWrapper::updateBatteryState()
|
|||||||
|
|
||||||
result = _nukiRetryHandler->retryComm([&]()
|
result = _nukiRetryHandler->retryComm([&]()
|
||||||
{
|
{
|
||||||
Nuki::CmdResult cmdResult = _nukiOpener.requestBatteryReport(&_batteryReport);
|
return _nukiOpener.requestBatteryReport(&_batteryReport);
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
return cmdResult;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(result == Nuki::CmdResult::Success)
|
if(result == Nuki::CmdResult::Success)
|
||||||
@@ -966,12 +955,7 @@ void NukiOpenerWrapper::updateAuth(bool retrieved)
|
|||||||
|
|
||||||
result = _nukiRetryHandler->retryComm([&]()
|
result = _nukiRetryHandler->retryComm([&]()
|
||||||
{
|
{
|
||||||
Nuki::CmdResult cmdResult = _nukiOpener.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
return _nukiOpener.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
return cmdResult;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(result == Nuki::CmdResult::Success)
|
if(result == Nuki::CmdResult::Success)
|
||||||
|
|||||||
@@ -324,12 +324,6 @@ void NukiWrapper::update(bool reboot)
|
|||||||
if(cmdResult != Nuki::CmdResult::Success)
|
if(cmdResult != Nuki::CmdResult::Success)
|
||||||
{
|
{
|
||||||
_network->publishRetry(std::to_string(retryCount + 1));
|
_network->publishRetry(std::to_string(retryCount + 1));
|
||||||
|
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
++retryCount;
|
++retryCount;
|
||||||
}
|
}
|
||||||
postponeBleWatchdog();
|
postponeBleWatchdog();
|
||||||
@@ -1134,12 +1128,7 @@ void NukiWrapper::updateAuth(bool retrieved)
|
|||||||
|
|
||||||
result = _nukiRetryHandler->retryComm([&]()
|
result = _nukiRetryHandler->retryComm([&]()
|
||||||
{
|
{
|
||||||
Nuki::CmdResult cmdResult = _nukiLock.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
return _nukiLock.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
return cmdResult;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
NukiHelper::printCommandResult(result);
|
NukiHelper::printCommandResult(result);
|
||||||
@@ -4010,18 +3999,9 @@ void NukiWrapper::readConfig()
|
|||||||
|
|
||||||
result = _nukiRetryHandler->retryComm([&]()
|
result = _nukiRetryHandler->retryComm([&]()
|
||||||
{
|
{
|
||||||
Nuki::CmdResult cmdResult = _nukiLock.requestConfig(&_nukiConfig);
|
return _nukiLock.requestConfig(&_nukiConfig);
|
||||||
|
|
||||||
if(result != Nuki::CmdResult::Success)
|
|
||||||
{
|
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmdResult;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4032,15 +4012,7 @@ void NukiWrapper::readAdvancedConfig()
|
|||||||
|
|
||||||
result = _nukiRetryHandler->retryComm([&]()
|
result = _nukiRetryHandler->retryComm([&]()
|
||||||
{
|
{
|
||||||
Nuki::CmdResult cmdResult = _nukiLock.requestAdvancedConfig(&_nukiAdvancedConfig);
|
return _nukiLock.requestAdvancedConfig(&_nukiAdvancedConfig);
|
||||||
if(result != Nuki::CmdResult::Success)
|
|
||||||
{
|
|
||||||
if (esp_task_wdt_status(NULL) == ESP_OK)
|
|
||||||
{
|
|
||||||
esp_task_wdt_reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cmdResult;
|
|
||||||
});
|
});
|
||||||
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
|
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ const Nuki::CmdResult NukiRetryHandler::retryComm(std::function<Nuki::CmdResult(
|
|||||||
|
|
||||||
while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
||||||
{
|
{
|
||||||
|
if (esp_task_wdt_status(NULL) == ESP_OK)
|
||||||
|
{
|
||||||
|
esp_task_wdt_reset();
|
||||||
|
}
|
||||||
|
|
||||||
cmdResult = func();
|
cmdResult = func();
|
||||||
|
|
||||||
if (cmdResult != Nuki::CmdResult::Success)
|
if (cmdResult != Nuki::CmdResult::Success)
|
||||||
|
|||||||
Reference in New Issue
Block a user