Skip to content

Commit 6aea9ef

Browse files
committed
Reverse orientation are now managed in config.yaml by the user.
Theme only sets landscape or portrait.
1 parent cedd9c2 commit 6aea9ef

File tree

8 files changed

+41
-21
lines changed

8 files changed

+41
-21
lines changed

config.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
config:
33
# Configuration values to set up basic communication
44
# Set your COM port e.g. COM3 for Windows, /dev/ttyACM0 for Linux...
5+
# Use AUTO for COM port auto-discovery (may not work on every setup)
56
# COM_PORT: "/dev/ttyACM0"
67
# COM_PORT: "COM3"
78
COM_PORT: "AUTO"
89

910
# Theme to use (located in res/themes)
10-
# THEME: Terminal
11-
# THEME: Landscape6Grid
12-
# THEME: Cyberpunk
13-
# THEME: bash-dark-green
11+
# Available themes:
12+
# - 3.5inchTheme2
13+
# - Terminal
14+
# - Landscape6Grid
15+
# - Cyberpunk
16+
# - bash-dark-green
1417
THEME: 3.5inchTheme2
1518

1619
# Hardware sensors reading
@@ -29,16 +32,23 @@ config:
2932
WLO: "wlan0" # Wi-Fi Card
3033

3134
display:
32-
# Display resolution in portrait orientation
33-
# Do not use this setting to rotate display! Display orientation is managed by themes
34-
DISPLAY_WIDTH: 320
35-
DISPLAY_HEIGHT: 480
35+
# Display revision: A or B (for "flagship" version, use B) or SIMU for simulated LCD (image written in screencap.png)
36+
# To identify your revision: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
37+
REVISION: A
3638

3739
# Display Brightness
3840
# Set this as the desired %, 0 being completely dark and 100 being max brightness
39-
# Warning: screen can get very hot at high brightness!
41+
# Warning: revision A display can get hot at high brightness!
4042
BRIGHTNESS: 20
4143

42-
# Display revision: A or B (for "flagship" version, use B) or SIMU for simulated LCD (image written in screencap.png)
43-
# To identify your revision: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
44-
REVISION: A
44+
# Display reverse: true/false
45+
# Set to true to reverse display orientation (landscape <-> reverse landscape, portrait <-> reverse portrait)
46+
# Note: Display basic orientation (portrait or landscape) is defined by the theme you have selected
47+
DISPLAY_REVERSE: false
48+
49+
# Display resolution in portrait orientation
50+
# Do not use this setting to rotate display! Use DISPLAY_REVERSE
51+
DISPLAY_WIDTH: 320 # Do not change unless you have a good reason
52+
DISPLAY_HEIGHT: 480 # Do not change unless you have a good reason
53+
54+

library/display.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ def _get_full_path(path, name):
1818

1919
def _get_theme_orientation() -> Orientation:
2020
if THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'portrait':
21-
return Orientation.PORTRAIT
21+
if CONFIG_DATA["display"].get("DISPLAY_REVERSE", False):
22+
return Orientation.REVERSE_PORTRAIT
23+
else:
24+
return Orientation.PORTRAIT
2225
elif THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'landscape':
23-
return Orientation.LANDSCAPE
26+
if CONFIG_DATA["display"].get("DISPLAY_REVERSE", False):
27+
return Orientation.REVERSE_LANDSCAPE
28+
else:
29+
return Orientation.LANDSCAPE
2430
elif THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'reverse_portrait':
31+
logger.warn("'reverse_portrait' is deprecated as DISPLAY_ORIENTATION value in the theme."
32+
"Use 'portrait' instead, and use DISPLAY_REVERSE in config.yaml to reverse orientation.")
2533
return Orientation.REVERSE_PORTRAIT
2634
elif THEME_DATA["display"]["DISPLAY_ORIENTATION"] == 'reverse_landscape':
35+
logger.warn("'reverse_landscape' is deprecated as DISPLAY_ORIENTATION value in the theme."
36+
"Use 'landscape' instead, and use DISPLAY_REVERSE in config.yaml to reverse orientation.")
2737
return Orientation.REVERSE_LANDSCAPE
2838
else:
2939
logger.warning("Orientation '", THEME_DATA["display"]["DISPLAY_ORIENTATION"], "' unknown, using portrait")

res/themes/3.5inchTheme2/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
display:
3-
# Specify the display orientation for this theme: portrait, landscape, reverse_portrait, reverse_landscape
3+
# Specify the display orientation for this theme: portrait or landscape
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)

res/themes/Cyberpunk/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
display:
3-
# Specify the display orientation for this theme: portrait, landscape, reverse_portrait, reverse_landscape
3+
# Specify the display orientation for this theme: portrait or landscape
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)

res/themes/Landscape6Grid/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
display:
3-
# Specify the display orientation for this theme: portrait, landscape, reverse_portrait, reverse_landscape
3+
# Specify the display orientation for this theme: portrait or landscape
44
DISPLAY_ORIENTATION: landscape
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)

res/themes/Terminal/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
display:
3-
# Specify the display orientation for this theme: portrait, landscape, reverse_portrait, reverse_landscape
3+
# Specify the display orientation for this theme: portrait or landscape
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)

res/themes/bash-dark-green/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
display:
3-
# Specify the display orientation for this theme: portrait, landscape, reverse_portrait, reverse_landscape
3+
# Specify the display orientation for this theme: portrait or landscape
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)

simple-program.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def sighandler(signum, frame):
6767
# Send initialization commands
6868
lcd_comm.InitializeComm()
6969

70-
# Set brightness in % (warning: screen can get very hot at high brightness!)
71-
lcd_comm.SetBrightness(level=25)
70+
# Set brightness in % (warning: revision A display can get hot at high brightness!)
71+
lcd_comm.SetBrightness(level=10)
7272

7373
# Set backplate RGB LED color (for supported HW only)
7474
lcd_comm.SetBackplateLedColor(led_color=(255, 255, 255))

0 commit comments

Comments
 (0)