Skip to content

Commit 509f294

Browse files
authored
Merge branch 'next' into current-mipi_dsi
2 parents 919cb14 + 644c924 commit 509f294

File tree

3 files changed

+108
-31
lines changed

3 files changed

+108
-31
lines changed

content/components/display/epaper_spi.md

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ with improved state management and non-blocking operation. This component implem
1212
queue-based state machine that eliminates blocking waits for the busy pin and provides
1313
better integration with ESPHome's async architecture.
1414

15-
The communication method uses 4-wire [SPI](/components/spi), so you need to have an `spi:` section in your
15+
The communication method uses [SPI](/components/spi), so you need to have an `spi:` section in your
1616
configuration.
1717

1818
The driver supports a number of displays and there are also specific configurations for ESP32 boards with integrated displays.
@@ -26,43 +26,85 @@ display:
2626
it.filled_circle(it.get_width() / 2, it.get_height() / 2, 50, Color::BLACK);
2727
```
2828
29-
## Supported displays
29+
## Supported display controllers
3030
31-
| Model name | Manufacturer | Product Description |
32-
| ---------------------- | ------------ | ---------------------------------------------------------- |
33-
| Spectra-E6 | Eink | <https://www.eink.com/brand/detail/Spectra6> |
34-
| 7.3in Spectra-E6 | Eink | <https://www.eink.com/product/detail/EL073TF1U5> |
35-
| Seeed-reTerminal-E1002 | Seeed Studio | <https://www.seeedstudio.com/reTerminal-E1002-p-6533.html> |
31+
These are the supported controller chips. Using just the chip name as the model will require full configuration with
32+
pins and dimensions specified.
33+
34+
| Chip name | Manufacturer | Product Description |
35+
|------------------------|--------------|------------------------------------------------------------------------------------------------------------------------------|
36+
| Spectra-E6 | Eink | <https://www.eink.com/brand/detail/Spectra6> |
37+
| SSD1677 | Solomon | <https://www.solomon-systech.com/product/ssd1677/> |
38+
39+
## Supported integrated display boards
40+
41+
These models correspond to displays integrated with a microcontroller, and have a full configuration predefined, so at
42+
a minimum only the model name need be configured. Other options can be overridden in the configuration if needed.
43+
44+
| Model name | Manufacturer | Product Description |
45+
| ---------------------- |--------------| ---------------------------------------------------------------------------------------------------------------------------- |
46+
| Seeed-reTerminal-E1002 | Seeed Studio | <https://www.seeedstudio.com/reTerminal-E1002-p-6533.html> |
47+
| Seeed-ee04-mono-4.26 | Seeed Studio | Seeed EE04 board with Waveshare 4.26" mono epaper. <https://www.seeedstudio.com/XIAO-ePaper-Display-Board-EE04-p-6560.html> |
3648
3749
## Configuration variables
3850
39-
When using a model defining an integrated ESP32 display board most of the configuration such as the pins and dimensions will be set by default,
51+
When using a model defining an integrated display board most of the configuration such as the pins and dimensions will be set by default,
4052
but can be overridden if needed.
4153
42-
- **model** (**Required**): The model of the ePaper display. See the table above for options.
54+
- **model** (**Required**): The model of the ePaper display. See the table above for options (case is not significant).
4355
- **cs_pin** (**Required**, [Pin Schema](/guides/configuration-types#pin-schema)): The CS pin. Predefined for integrated boards.
4456
- **dc_pin** (**Required**, [Pin Schema](/guides/configuration-types#pin-schema)): The DC pin. Predefined for integrated boards.
4557
- **busy_pin** (*Optional*, [Pin Schema](/guides/configuration-types#pin-schema)): The BUSY pin, if used.
4658
- **reset_pin** (*Optional*, [Pin Schema](/guides/configuration-types#pin-schema)): The RESET pin, if used.
4759
Make sure you pull this pin high (by connecting it to 3.3V with a resistor) if not connected to a GPIO pin.
60+
- **dimensions** (**Required**, dict): Dimensions of the screen, specified either as *width* **x** *height* (e.g `320x240` )
61+
or with separate config keys. For integrated boards with full pre-defined configuration this is optional and will be preset by
62+
the model selected. The dimensions are specified in pixels, and the width and height must be greater than 0.
4863

49-
- **rotation** (*Optional*): Set the rotation of the display. Everything you draw in `lambda:` will be rotated
64+
- **height** (**Required**, int): Specifies height of display.
65+
- **width** (**Required**, int): Specifies width of display.
66+
67+
- **rotation** (*Optional*, int): Set the rotation of the display. Everything you draw in `lambda:` will be rotated
5068
by this option. One of `0°` (default), `90°`, `180°`, `270°`.
69+
- **transform** (*Optional*, dict): If `rotation` is not sufficient, use this to transform the display. Options are:
70+
- **mirror_x** (**Required**, boolean): If true, mirror the x axis.
71+
- **mirror_y** (**Required**, boolean): If true, mirror the y axis.
5172

5273
- **reset_duration** (*Optional*, [Time](/guides/configuration-types#time)): Duration for the display reset operation. Defaults to `200ms`.
53-
5474
- **lambda** (*Optional*, [lambda](/automations/templates#config-lambda)): The lambda to use for rendering the content on the display.
5575
See [Display Rendering Engine](/components/display#display-engine) for more information.
5676
- **pages** (*Optional*, list): Show pages instead of a single lambda. See [Display Pages](/components/display#display-pages).
57-
5877
- **update_interval** (*Optional*, [Time](/guides/configuration-types#time)): The interval to re-draw the screen. Defaults to `60s`,
5978
use `never` to only manually update the screen via `component.update`.
60-
- **spi_id** (*Optional*, [ID](/guides/configuration-types#id)): Manually specify the ID of the [SPI Component](/components/spi) if you want
61-
to use multiple SPI buses.
79+
- **full_update_every** (*Optional*, int): On screens that support partial updates, this sets the number of updates
80+
before a full update is forced. Defaults to `1` which will make every update a full update.
81+
- **spi_id** (*Optional*, [ID](/guides/configuration-types#id)): Required to specify the ID of the [SPI Component](/components/spi) if your
82+
configuration defines multiple SPI buses. If only a single SPI bus is configured, this is optional.
6283
- **id** (*Optional*, [ID](/guides/configuration-types#id)): Manually specify the ID used for code generation.
6384

85+
### Full configuration example
86+
87+
```yaml
88+
display:
89+
- platform: epaper_spi
90+
model: SSD1677
91+
full_update_every: 10
92+
update_interval: 5s
93+
dimensions:
94+
width: 800
95+
height: 480
96+
transform:
97+
mirror_x: true
98+
mirror_y: false
99+
rotation: 90 # Rotate to portrait
100+
cs_pin: GPIOXX
101+
dc_pin: GPIOXX
102+
reset_pin: GPIOXX
103+
busy_pin: { number: GPIOXX, inverted: False, mode: { input: True, pulldown: True } }
104+
```
105+
64106
## See Also
65107

66-
- {{< docref "index/" >}}
67108
- {{< apiref "epaper_spi/epaper_spi.h" "epaper_spi/epaper_spi.h" >}}
68109
- [ESPHome Display Rendering Engine](/components/display#display-engine)
110+
- {{< docref "components/lvgl" >}}

content/components/lvgl/_index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ The following configuration variables apply to the main `lvgl` component, in ord
131131
> - If you press the encoder on a complex object (like a list, message box, etc.) the object will go to edit mode whereby you can adjust the value of the object by turning the encoder.
132132
> - To leave edit mode, long press the button.
133133

134+
- **update_when_display_idle** (*Optional*, boolean): When using the {{< docref "/components/display/epaper_spi" >}}
135+
or other displays with long update times, setting this option
136+
to `true` will cause the display to only be updated if the display is idle. During the update LVGL will pause.
137+
The display `update_interval` should be set to `never` when this is used, as the display will be updated automatically
138+
by LVGL.
134139
- **resume_on_input** (*Optional*, boolean): If LVGL is paused and the user interacts with the screen, resume the activity of LVGL. Defaults to `true`. "Interacts" means to release a touch or button, or rotate an encoder.
135140
- **color_depth** (*Optional*, string): The color depth at which the contents are generated. Currently only `16` is supported (RGB565, 2 bytes/pixel), which is the default value.
136141
- **buffer_size** (*Optional*, percentage): The percentage of screen size to allocate buffer memory. If unconfigured, the default is `100%` with runtime fallback to `12%` if a full size buffer allocation fails. For devices without PSRAM, the recommended value is `25%`.

content/components/lvgl/widgets.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ The properties below are common to all widgets.
3838
- `"ON"` : Always show the scroll bars (use the double quotes!).
3939
- `"ACTIVE"` : Show scroll bars while a widget is being scrolled.
4040
- `"AUTO"` : Show scroll bars when the content is large enough to be scrolled (default).
41-
41+
- **scroll_dir** (*Optional*, string): Sets the permissible scroll directions for an object - one of `LEFT`, `RIGHT`,
42+
`BOTTOM`, `TOP`, `HOR`, `VER`, `ALL` (default).
43+
- **scroll_snap_x** (*Optional*, string): For a child of a scrollable object, this property defines the snap position
44+
of the child in the X direction. One of `NONE` (default), `START`, `END`, `CENTER`.
45+
- **scroll_snap_y** (*Optional*, string): For a child of a scrollable object, this property defines the snap position
46+
of the child in the Y direction. One of `NONE` (default), `START`, `END`, `CENTER`.
4247
- **align** (*Optional*, enum): Alignment of the widget relative to the parent. A child widget is clipped to its parent boundaries. One of the values *not* starting with `OUT_` (see picture below).
4348
- **align_to** (*Optional*, list): Alignment of the widget relative to another widget on the same level:
4449
- **id** (**Required**): The ID of a widget *to* which you want to align.
@@ -424,9 +429,17 @@ Simple push (momentary) or toggle (two-states) button.
424429

425430
{{< img src="lvgl_button.png" alt="Image" class="align-center" >}}
426431

432+
A button has no inherent content so requires child widgets to be added. As a shorthand for a button with a single text label,
433+
the `text:` option may be used to add a single `label` child, otherwise the `widgets:` key must be used to add other
434+
widgets inside the button.
435+
436+
A button is momentary by default, which has a `pressed` state. If the `checkable` flag is set, it becomes a toggle button, which also has a `checked` state.
437+
427438
**Configuration variables:**
428439

429-
- **checkable** (*Optional*, boolean): A significant [flag](#lvgl-widget-flags) to make a toggle button (which remains pressed in `checked` state). Defaults to `false`.
440+
- **checkable** (*Optional*, boolean): A significant [flag](#lvgl-widget-flags) to make a toggle button (which reports its `checked` state). Defaults to `false`.
441+
- **text** (*Optional*, string): Text to be displayed on the button. This will create and add a single label widget to the button. May not be used
442+
with the `widgets:` key.
430443
- Style options from [Style properties](/components/lvgl#lvgl-styling) for the background of the button. Uses the typical background style properties.
431444

432445
A notable state is `checked` (boolean) which can have different styles applied.
@@ -440,30 +453,22 @@ A notable state is `checked` (boolean) which can have different styles applied.
440453
**Example:**
441454

442455
```yaml
443-
# Example widget:
456+
# Example widget with text:
444457
- button:
445-
x: 10
446-
y: 10
447-
width: 50
448-
height: 30
449458
id: btn_id
459+
text: "Click me!"
450460
```
451461

452-
To have a button with a text label on it, add a child [`label`](#lvgl-widget-label) widget to it:
462+
To create an image button, add a child [`image`](#lvgl-widget-image) widget to it:
453463

454464
```yaml
455-
# Example toggle button with text:
465+
# Example toggle button with image:
456466
- button:
457-
x: 10
458-
y: 10
459-
width: 70
460-
height: 30
461467
id: btn_id
462468
checkable: true
463469
widgets:
464-
- label:
465-
align: center
466-
text: "Light"
470+
- image:
471+
src: my_image_id
467472
468473
# Example trigger:
469474
- button:
@@ -473,12 +478,37 @@ To have a button with a text label on it, add a child [`label`](#lvgl-widget-lab
473478
- logger.log:
474479
format: "Button checked state: %d"
475480
args: [ x ]
481+
476482
```
477483

478484
The `button` can be also integrated as a {{< docref "/components/binary_sensor/lvgl" "Binary Sensor" >}} or as a {{< docref "/components/switch/lvgl" "Switch" >}} component.
485+
> [!NOTE]
486+
> A binary sensor linked to a button reports its `pressed` state, while a switch linked to a button reports its `checked` state.
479487

480488
See [Remote light button](/cookbook/lvgl#lvgl-cookbook-binent) for an example which demonstrates how to use a checkable button to act on a Home Assistant service.
481489

490+
**Actions:**
491+
492+
- `lvgl.button.update` [action](/automations/actions#actions-action) may be used to update the button styles at runtime. If
493+
the button has a `text:` option then it may also be updated with this action.
494+
- **id** (**Required**): The ID or a list of IDs of button widgets to be updated.
495+
- **text** (*Optional*, string): Update the button's text (only if the button was configured with the `text:` option).
496+
- Style options from [Style properties](/components/lvgl#lvgl-styling) for the background of the button.
497+
498+
> [!NOTE]
499+
> Where other widgets are added as children, they must be updated directly.
500+
501+
```yaml
502+
# Text update example
503+
- button:
504+
id: btn_id
505+
text: "Click me!"
506+
on_click:
507+
lvgl.button.update:
508+
id: btn_id
509+
text: "Clicked"
510+
```
511+
482512
{{< anchor "lvgl-widget-buttonmatrix" >}}
483513

484514
## `buttonmatrix`

0 commit comments

Comments
 (0)