Skip to content

Commit

Permalink
docs: correct Float type size in Preferences API and Tutorial documen…
Browse files Browse the repository at this point in the history
…tation (#10113)

* 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()`.

* Update Float call prototype

* Correct Float type size

Correct Float type size in the Preferences Types table.
Revise text to use `float_t` in place of `float`.

* Correct doc build error

Correct the `Explicit markup ends without a blank line; unexpected unindent.`
  • Loading branch information
Xylopyrographer authored Aug 13, 2024
1 parent 5b05a34 commit f1df088
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions docs/en/api/preferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -258,6 +258,8 @@ Arduino-esp32 Preferences API
``putInt, putUInt``
********************
``putLong, putULong``
**********************
``putFloat``
**********************

Store a value against a given key in the currently open namespace.
Expand All @@ -268,6 +270,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)
..
Expand All @@ -288,16 +291,15 @@ Arduino-esp32 Preferences API

``putLong64, putULong64``
*************************
``putFloat, putDouble``
***********************
``putDouble``
*************************

Store a value against a given key in the currently open namespace.

.. code-block:: arduino
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)
..
Expand Down
12 changes: 6 additions & 6 deletions docs/en/tutorials/preferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f1df088

Please sign in to comment.