Streamlined NVS recall for String values

Avoids need for intermediate variable
This commit is contained in:
Gregg 2023-11-24 18:05:49 -06:00
parent 9e3f6c8303
commit c4e88d7df0
1 changed files with 2 additions and 3 deletions

View File

@ -635,9 +635,8 @@ class SpanCharacteristic{
} }
} else { } else {
if(!nvs_get_str(homeSpan.charNVS,nvsKey,NULL,&len)){ if(!nvs_get_str(homeSpan.charNVS,nvsKey,NULL,&len)){
char c[len]; value.STRING = (char *)HS_REALLOC(value.STRING,len);
nvs_get_str(homeSpan.charNVS,nvsKey,c,&len); nvs_get_str(homeSpan.charNVS,nvsKey,value.STRING,&len);
uvSet(value,(const char *)c);
} }
else { else {
nvs_set_str(homeSpan.charNVS,nvsKey,value.STRING); // store string data nvs_set_str(homeSpan.charNVS,nvsKey,value.STRING); // store string data