Enlarge stack and check for valid config on JSON command

This commit is contained in:
iranl
2024-05-11 23:09:38 +02:00
parent a6cb6c10dc
commit ab0c2bf768
3 changed files with 44 additions and 15 deletions

View File

@@ -767,9 +767,18 @@ Nuki::BatteryType NukiOpenerWrapper::batteryTypeToEnum(const char* str)
void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
{
JsonDocument jsonResult;
char _resbuf[2048];
if(!_configRead || !_nukiConfigValid)
{
jsonResult["general"] = "configNotReady";
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
_network->publishConfigCommandResult(_resbuf);
return;
}
if(_nukiOpener.getSecurityPincode() == 0)
{
jsonResult["general"] = "noPinSet";
@@ -1744,6 +1753,12 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
{
if(!_configRead || !_nukiConfigValid)
{
_network->publishTimeControlCommandResult("configNotReady");
return;
}
if(_nukiOpener.getSecurityPincode() == 0)
{
_network->publishTimeControlCommandResult("noPinSet");

View File

@@ -707,6 +707,14 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
JsonDocument jsonResult;
char _resbuf[2048];
if(!_configRead || !_nukiConfigValid)
{
jsonResult["general"] = "configNotReady";
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
_network->publishConfigCommandResult(_resbuf);
return;
}
if(_nukiLock.getSecurityPincode() == 0)
{
jsonResult["general"] = "noPinSet";
@@ -1731,6 +1739,12 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
void NukiWrapper::onTimeControlCommandReceived(const char *value)
{
if(!_configRead || !_nukiConfigValid)
{
_network->publishTimeControlCommandResult("configNotReady");
return;
}
if(_nukiLock.getSecurityPincode() == 0)
{
_network->publishTimeControlCommandResult("noPinSet");

View File

@@ -112,9 +112,9 @@ void setupTasks()
{
// configMAX_PRIORITIES is 25
xTaskCreatePinnedToCore(networkTask, "ntw", 10240, NULL, 3, &networkTaskHandle, 1);
xTaskCreatePinnedToCore(nukiTask, "nuki", 5120, NULL, 2, &nukiTaskHandle, 1);
xTaskCreatePinnedToCore(presenceDetectionTask, "prdet", 896, NULL, 5, &presenceDetectionTaskHandle, 1);
xTaskCreatePinnedToCore(networkTask, "ntw", 12288, NULL, 3, &networkTaskHandle, 1);
xTaskCreatePinnedToCore(nukiTask, "nuki", 8192, NULL, 2, &nukiTaskHandle, 1);
xTaskCreatePinnedToCore(presenceDetectionTask, "prdet", 1024, NULL, 5, &presenceDetectionTaskHandle, 1);
}
void initEthServer(const NetworkDeviceType device)