Merge pull request #2401 from tubalainen/patch-6

id cannot be the same as the component name
This commit is contained in:
H. Árkosi Róbert 2022-10-30 21:25:31 +01:00 committed by GitHub
commit c6382f757e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ The :ref:`SPI <spi>` is required to be set up in your configuration for this sen
# Example configuration entry
touchscreen:
platform: xpt2046
id: touchscreen
id: my_touchscreen
cs_pin: 17
interrupt_pin: 16
update_interval: 50ms
@ -103,15 +103,15 @@ values nor ``swap_x_y``.
# Touchscreen
touchscreen:
platform: xpt2046
id: touchscreen
id: my_touchscreen
cs_pin: 17
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
id(touchscreen).x,
id(touchscreen).y,
id(touchscreen).x_raw,
id(touchscreen).y_raw
id(my_touchscreen).x,
id(my_touchscreen).y,
id(my_touchscreen).x_raw,
id(my_touchscreen).y_raw
);
Get a stylus or a similar object, run the project and touch the corners of the screen at
@ -176,8 +176,8 @@ using a display lambda similar to the following.
- platform: ili9341
lambda: |-
it.fill(BLACK);
if (id(touchscreen).touched)
it.filled_circle(id(touchscreen).x, id(touchscreen).y, 10, RED);
if (id(my_touchscreen).touched)
it.filled_circle(id(my_touchscreen).x, id(my_touchscreen).y, 10, RED);
To be exact, the component does the following