feat(nvs_flash): Added support for storing flash and double types

- added backward compatibility test for unknown NVS entry types
 - axtended documentation with the support of double and float
This commit is contained in:
radek.tandler
2026-03-31 19:02:43 +02:00
parent e07b6dec77
commit a5443bbb94
12 changed files with 1146 additions and 21 deletions
+12 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -37,6 +37,8 @@ enum class ItemType : uint8_t {
I32 = NVS_TYPE_I32,
U64 = NVS_TYPE_U64,
I64 = NVS_TYPE_I64,
FLOAT = NVS_TYPE_FLOAT,
DOUBLE = NVS_TYPE_DOUBLE,
SZ = NVS_TYPE_STR,
BLOB = 0x41,
BLOB_DATA = NVS_TYPE_BLOB,
@@ -298,6 +300,15 @@ constexpr ItemType itemTypeOf()
return static_cast<ItemType>(((std::is_signed<T>::value)?0x10:0x00) | sizeof(T));
}
/**
* Help to translate IEEE 754 floating-point types into ItemType.
*/
template<typename T, typename std::enable_if<std::is_floating_point<T>::value, char>::type = 0>
constexpr ItemType itemTypeOf()
{
return static_cast<ItemType>(0x20 | sizeof(T));
}
template<typename T>
constexpr ItemType itemTypeOf(const T&)
{