UIFlow2.0 NVS how-to check pre-existence (ESP_ERR_NVS_NOT_FOUND)
-
Hi, I want to use NVS in UIFlow2.0 with blocks, but I think this is not possible.
Normally, you should read a nvs value and, if it does not exist, create it, but there is no block to check the existence of a variable, and reading a variable which does not exist causes the program to crash (ESP_ERR_NVS_NOT_FOUND).
How I can do that check? Can I catch the error so the program is not stopped? -
Hello @txinto
you can wrap the get key block in a
try / except
block. See example M5Dial_NVS_UIFlow2.0.1 in the UIFlow2 Project Zone.Thanks
Felix