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");