91JJ
(91JJ)
1
Is it possible to have one display with config for the screen landscape.
Then be able to go to a specific page and that page be in portrait ?
I tried it with two displays, but every 5 seconds it flashes between them both.
I have tried this thread Oled display rotation based on a sensor however, it appears the “rotation” can’t be templated.
Or just have multiple screens?
display:
- platform: st7789v
backlight_pin: GPIO4
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 270 //Be able to make this custom
id: my_display
update_interval: 1s
pages:
- id: page1
lambda: |-
// Screen 2 (does display, but automatically cycles between screens
- platform: st7789v
backlight_pin: GPIO4
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 0
id: my_display2
update_interval: 0s
pages:
- id: page99
lambda: |-
zoogara
(Daryl)
3
Pretty certain neither will work, as the rotation is not templatable and set at compile time.
Have you actually tried the 2 screen idea?
91JJ
(91JJ)
4
Yeah I think the only way would be to rotate everything within the lambda if that’s even possible.
Yes did try it, bit just “flashes” the second screen every 5 seconds or so.
luma
5
Did you ever figure out a solution here? I’m chasing down the same goal here and running up against the same problem.
edit: OK figured out a solution here
- id: page4 # PM10 graph
lambda: |-
it.set_rotation(DISPLAY_ROTATION_270_DEGREES);
luma
6
Filling this out a bit more, here’s how I managed to get a display to rotate via button press:
globals:
- id: global_display_rotation
type: esphome::display::DisplayRotation
restore_value: yes
initial_value: 'DISPLAY_ROTATION_0_DEGREES'
button:
- platform: template
name: "Rotate Screen"
id: button_rotate_screen
on_press:
then:
- lambda: |-
switch (id(global_display_rotation)) {
case DISPLAY_ROTATION_0_DEGREES:
id(global_display_rotation) = DISPLAY_ROTATION_90_DEGREES;
break;
case DISPLAY_ROTATION_90_DEGREES:
id(global_display_rotation) = DISPLAY_ROTATION_180_DEGREES;
break;
case DISPLAY_ROTATION_180_DEGREES:
id(global_display_rotation) = DISPLAY_ROTATION_270_DEGREES;
break;
default:
id(global_display_rotation) = DISPLAY_ROTATION_0_DEGREES;
}
- component.update: my_display
display:
- platform: st7789v # 135x240
model: TTGO TDisplay 135x240
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 90
id: my_display
pages:
- id: page1
lambda: |-
it.set_rotation(id(global_display_rotation));
2 Likes
91JJ
(91JJ)
7
Thanks!
Will give it a try.
91JJ
(91JJ)
8
I can’t get this to work.
When I view the page99, it rotates all other pages until I get back to page99 then rotates again.
The button doesn’t do anything.
Can you share your full condig?