From 72934a9606cc9933cf86bce4274f5130af51b74c Mon Sep 17 00:00:00 2001 From: Xylopyrographer Date: Sun, 4 Aug 2024 23:13:41 -0600 Subject: [PATCH 1/4] Correct Float type size Correct in the data type table and the API call the size of the Preferences `Float` type and returned value for `putFloat()`. --- docs/en/api/preferences.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/en/api/preferences.rst b/docs/en/api/preferences.rst index ca443a9475d..117e448c9a0 100644 --- a/docs/en/api/preferences.rst +++ b/docs/en/api/preferences.rst @@ -62,12 +62,12 @@ Preferences directly supports the following data types: +-------------------+-------------------+---------------+ | ULong | uint32_t | 4 | +-------------------+-------------------+---------------+ + | Float | float_t | 4 | + +-------------------+-------------------+---------------+ | Long64 | int64_t | 8 | +-------------------+-------------------+---------------+ | ULong64 | uint64_t | 8 | +-------------------+-------------------+---------------+ - | Float | float_t | 8 | - +-------------------+-------------------+---------------+ | Double | double_t | 8 | +-------------------+-------------------+---------------+ | | const char* | variable | @@ -76,7 +76,6 @@ Preferences directly supports the following data types: +-------------------+-------------------+---------------+ | Bytes | uint8_t | variable | +-------------------+-------------------+---------------+ - String values can be stored and retrieved either as an Arduino String or as a null terminated ``char`` array (c-string). Bytes type is used for storing and retrieving an arbitrary number of bytes in a namespace. @@ -258,6 +257,8 @@ Arduino-esp32 Preferences API ``putInt, putUInt`` ******************** ``putLong, putULong`` +********************** +``putFloat`` ********************** Store a value against a given key in the currently open namespace. @@ -288,8 +289,8 @@ Arduino-esp32 Preferences API ``putLong64, putULong64`` ************************* -``putFloat, putDouble`` -*********************** +``putDouble`` +************************* Store a value against a given key in the currently open namespace. From 72d94b222cd586e58fc39317186e1cf4192f62ad Mon Sep 17 00:00:00 2001 From: Xylopyrographer Date: Sun, 4 Aug 2024 23:16:02 -0600 Subject: [PATCH 2/4] Update Float call prototype --- docs/en/api/preferences.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/api/preferences.rst b/docs/en/api/preferences.rst index 117e448c9a0..51355e25143 100644 --- a/docs/en/api/preferences.rst +++ b/docs/en/api/preferences.rst @@ -269,6 +269,7 @@ Arduino-esp32 Preferences API size_t putUInt(const char* key, uint32_t value) size_t putLong(const char* key, int32_t value) size_t putULong(const char* key, uint32_t value) + size_t putFloat(const char* key, float_t value) .. @@ -298,7 +299,6 @@ Arduino-esp32 Preferences API size_t putLong64(const char* key, int64_t value) size_t putULong64(const char* key, uint64_t value) - size_t putFloat(const char* key, float_t value) size_t putDouble(const char* key, double_t value) .. From 9e71632aa15d646fbb02b2bd96bfcc9c966bcddf Mon Sep 17 00:00:00 2001 From: Xylopyrographer Date: Sun, 4 Aug 2024 23:26:14 -0600 Subject: [PATCH 3/4] Correct Float type size Correct Float type size in the Preferences Types table. Revise text to use `float_t` in place of `float`. --- docs/en/tutorials/preferences.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/en/tutorials/preferences.rst b/docs/en/tutorials/preferences.rst index dd27913c38f..2239f4b8437 100644 --- a/docs/en/tutorials/preferences.rst +++ b/docs/en/tutorials/preferences.rst @@ -70,16 +70,16 @@ Preferences directly supports the following data types: +-------------------+-------------------+---------------+ | ULong | uint32_t | 4 | +-------------------+-------------------+---------------+ + | Float | float_t | 4 | + +-------------------+-------------------+---------------+ | Long64 | int64_t | 8 | +-------------------+-------------------+---------------+ | ULong64 | uint64_t | 8 | +-------------------+-------------------+---------------+ - | Float | float_t | 8 | - +-------------------+-------------------+---------------+ | Double | double_t | 8 | +-------------------+-------------------+---------------+ - | | const char* | | - | String +-------------------+ variable | + | | const char* | variable | + | String +-------------------+ | | | String | | +-------------------+-------------------+---------------+ | Bytes | uint8_t | variable | @@ -233,9 +233,9 @@ Like so: .. code-block:: arduino - float myFloat = myPreferences.getFloat("pi"); + float_t myFloat = myPreferences.getFloat("pi"); -This will retrieve the float value from the namespace key ``"pi"`` and assign it to the float type variable ``myFloat``. +This will retrieve the float_t value from the namespace key ``"pi"`` and assign it to the float_t type variable ``myFloat``. Summary From 129423735e1bb423208f4725d953f5fb5e1f26e7 Mon Sep 17 00:00:00 2001 From: Xylopyrographer Date: Mon, 5 Aug 2024 11:15:18 -0600 Subject: [PATCH 4/4] Correct doc build error Correct the `Explicit markup ends without a blank line; unexpected unindent.` --- docs/en/api/preferences.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/api/preferences.rst b/docs/en/api/preferences.rst index 51355e25143..2ff6f178347 100644 --- a/docs/en/api/preferences.rst +++ b/docs/en/api/preferences.rst @@ -76,6 +76,7 @@ Preferences directly supports the following data types: +-------------------+-------------------+---------------+ | Bytes | uint8_t | variable | +-------------------+-------------------+---------------+ + String values can be stored and retrieved either as an Arduino String or as a null terminated ``char`` array (c-string). Bytes type is used for storing and retrieving an arbitrary number of bytes in a namespace.