There doesn't seem to be an implementation for either bool or float in the nvs_flash component. Is there a reason?
bool is easy to represent as an integer of course but having a specific type for it is handy on read because you can translate the value to a 'true" or "false" string.
I added the necessary code in nvs_flash and it seemed to be trivial once I figured out that the enum values in nvs_type_t actually have special meanings (they tell nvs_page whether it's signed or unsigned, and the length).
Did I miss something that might cause problems?
Is there a reason bool and float aren't supported in nvs_flash?
Re: Is there a reason bool and float aren't supported in nvs_flash?
It does seem a little arbitrary. Maybe the developers considered the integer types as being the most common (?).
I chased down various predefined functions and it seems that, under the hood, it ultimately treats each as a small binary object (bsob? haha) whose length is sizeof(T) where T is the type as determined by a generically defined function. So for bool or floats, as long as you are establishing the size of the data type properly, you should be fine.
I chased down various predefined functions and it seems that, under the hood, it ultimately treats each as a small binary object (bsob? haha) whose length is sizeof(T) where T is the type as determined by a generically defined function. So for bool or floats, as long as you are establishing the size of the data type properly, you should be fine.
Re: Is there a reason bool and float aren't supported in nvs_flash?
The template for "is_integral" in nvs_handle.hpp needed to be split out to 3 separate cases because float isn't integral and even though bool is, the way the logic works it'd be resolved to signed-no, length 1 (0x01) NVS_TYPE_U8 .
Who is online
Users browsing this forum: No registered users and 123 guests