Skip to content

Commit 20a0f88

Browse files
committed
Fix examples
1 parent 121ea49 commit 20a0f88

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

components/mapping.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Using a mapping
4848

4949
A mapping defined in this component can be used in lambdas in other components. The mapping can be accessed using
5050
the ``id`` function, and the value can be looked up using the ``[]`` operator as per the above example, or the ``get`` function.
51-
A map may be updated at run time using a lambda call, e.g. ``map["key"] = value`` or ``map.set("key", value)``.
51+
A map may be updated at run time using a lambda call, e.g. ``map.set("key", value)``.
5252

5353
Maps are stored in RAM, but will use PSRAM if available.
5454

@@ -79,8 +79,6 @@ A more complex example follows:
7979
hex: 00FF00
8080
- id: blue
8181
hex: 0000FF
82-
- id: magenta
83-
hex: FF00FF
8482
8583
font:
8684
- file: gfonts://Roboto
@@ -92,14 +90,14 @@ A more complex example follows:
9290
- platform: ...
9391
# update the display drawing random text in random colors
9492
lambda: |-
95-
auto color = color_map.get(random_uint32() % 4]); # Uses get() to index the color_map
93+
auto color = color_map.get(random_uint32() % 3]); # Uses get() to index the color_map
9694
it.printf(100, 100, id(roboto20), color, id(string_map)[random_uint32() % 3].c_str(), Color(0));
9795
9896
9997
on_...:
10098
then:
10199
- lambda: |-
102-
id(color_map)[2] = Color::random_color();
100+
id(color_map).set(2, Color::random_color());
103101
104102
See Also
105103
--------

0 commit comments

Comments
 (0)