Skip to content

Commit 3b0c033

Browse files
committed
Add config option for reset workaround rev.A
1 parent 8effcd9 commit 3b0c033

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

config.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
---
21
config:
32
# Configuration values to set up basic communication
43
# Set your COM port e.g. COM3 for Windows, /dev/ttyACM0 for Linux...
54
# Use AUTO for COM port auto-discovery (may not work on every setup)
65
# COM_PORT: "/dev/ttyACM0"
76
# COM_PORT: "COM3"
8-
COM_PORT: "AUTO"
7+
COM_PORT: COM1
98

109
# Theme to use (located in res/themes)
1110
# Use the name of the folder as value
12-
THEME: 3.5inchTheme2
11+
THEME: Cyberpunk-net
1312

1413
# Hardware sensors reading
1514
# Choose the appropriate method for reading your hardware sensors:
1615
# - PYTHON use Python libraries (psutils, GPUtil...) to read hardware sensors (supports all OS but not all HW)
1716
# - LHM use LibreHardwareMonitor library to read hardware sensors (Windows only - NEEDS ADMIN RIGHTS)
1817
# - STUB / STATIC use random/static data instead of real hardware sensors
1918
# - AUTO use the best method based on your OS: Windows OS will use LHM, other OS will use Python libraries
20-
HW_SENSORS: AUTO
19+
HW_SENSORS: PYTHON
2120

2221
# Network interfaces
2322
# Linux/MacOS interfaces are named "eth0", "wlan0", "wlp1s0", "enp2s0"...
2423
# For Windows use the interfaces pretty name: "Ethernet 2", "Wi-Fi", ...
2524
# Leave the fields empty if the card does not exist on your setup
26-
ETH: "" # Ethernet Card
27-
WLO: "" # Wi-Fi Card
25+
ETH: Ethernet # Ethernet Card
26+
WLO: Wi-Fi # Wi-Fi Card
2827

2928
# CPU fan
3029
# For Linux/MacOS platforms, the CPU fan is amongst all fan sensors gathered from the motherboard chipset
@@ -40,7 +39,7 @@ config:
4039

4140
# OpenWeatherMap API KEY. Can be obtained by creating a free account on https://home.openweathermap.org/users/sign_up.
4241
# You need to subscribe to the 3.0 OneCallAPI that has 1000 free daily calls
43-
WEATHER_API_KEY: ""
42+
WEATHER_API_KEY: ''
4443
# Location from which to display the weather. Use for example https://www.latlong.net/ to get latitude/longitude
4544
WEATHER_LATITUDE: 45.75
4645
WEATHER_LONGITUDE: 4.85
@@ -68,4 +67,7 @@ display:
6867
# Display reverse: true/false
6968
# Set to true to reverse display orientation (landscape <-> reverse landscape, portrait <-> reverse portrait)
7069
# Note: Display basic orientation (portrait or landscape) is defined by the theme you have selected
71-
DISPLAY_REVERSE: false
70+
DISPLAY_REVERSE: true
71+
72+
# https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions#with-separate-mainboard
73+
WORKAROUND_RESET: Y

library/display.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ def __init__(self):
7474
self.lcd = LcdSimulated(display_width=480,
7575
display_height=800)
7676
else:
77-
logger.error("Unknown display revision '", config.CONFIG_DATA["display"]["REVISION"], "'")
77+
logger.error("Unknown display revision '",
78+
config.CONFIG_DATA["display"]["REVISION"], "'")
7879

7980
def initialize_display(self):
8081
# Reset screen in case it was in an unstable state (screen is also cleared)
81-
self.lcd.Reset()
82+
if config.CONFIG_DATA["display"]["WORKAROUND_RESET"] != "Y":
83+
self.lcd.Reset()
8284

8385
# Send initialization commands
8486
self.lcd.InitializeComm()
@@ -97,7 +99,8 @@ def turn_on(self):
9799
self.lcd.SetBrightness(config.CONFIG_DATA["display"]["BRIGHTNESS"])
98100

99101
# Set backplate RGB LED color (for supported HW only)
100-
self.lcd.SetBackplateLedColor(config.THEME_DATA['display'].get("DISPLAY_RGB_LED", (255, 255, 255)))
102+
self.lcd.SetBackplateLedColor(
103+
config.THEME_DATA['display'].get("DISPLAY_RGB_LED", (255, 255, 255)))
101104

102105
def turn_off(self):
103106
# Turn screen off
@@ -111,11 +114,14 @@ def display_static_images(self):
111114
for image in config.THEME_DATA['static_images']:
112115
logger.debug(f"Drawing Image: {image}")
113116
self.lcd.DisplayBitmap(
114-
bitmap_path=config.THEME_DATA['PATH'] + config.THEME_DATA['static_images'][image].get("PATH"),
117+
bitmap_path=config.THEME_DATA['PATH'] +
118+
config.THEME_DATA['static_images'][image].get("PATH"),
115119
x=config.THEME_DATA['static_images'][image].get("X", 0),
116120
y=config.THEME_DATA['static_images'][image].get("Y", 0),
117-
width=config.THEME_DATA['static_images'][image].get("WIDTH", 0),
118-
height=config.THEME_DATA['static_images'][image].get("HEIGHT", 0)
121+
width=config.THEME_DATA['static_images'][image].get(
122+
"WIDTH", 0),
123+
height=config.THEME_DATA['static_images'][image].get(
124+
"HEIGHT", 0)
119125
)
120126

121127
def display_static_text(self):
@@ -126,17 +132,26 @@ def display_static_text(self):
126132
text=config.THEME_DATA['static_text'][text].get("TEXT"),
127133
x=config.THEME_DATA['static_text'][text].get("X", 0),
128134
y=config.THEME_DATA['static_text'][text].get("Y", 0),
129-
width=config.THEME_DATA['static_text'][text].get("WIDTH", 0),
130-
height=config.THEME_DATA['static_text'][text].get("HEIGHT", 0),
131-
font=config.FONTS_DIR + config.THEME_DATA['static_text'][text].get("FONT", "roboto-mono/RobotoMono-Regular.ttf"),
132-
font_size=config.THEME_DATA['static_text'][text].get("FONT_SIZE", 10),
133-
font_color=config.THEME_DATA['static_text'][text].get("FONT_COLOR", (0, 0, 0)),
134-
background_color=config.THEME_DATA['static_text'][text].get("BACKGROUND_COLOR", (255, 255, 255)),
135+
width=config.THEME_DATA['static_text'][text].get(
136+
"WIDTH", 0),
137+
height=config.THEME_DATA['static_text'][text].get(
138+
"HEIGHT", 0),
139+
font=config.FONTS_DIR +
140+
config.THEME_DATA['static_text'][text].get(
141+
"FONT", "roboto-mono/RobotoMono-Regular.ttf"),
142+
font_size=config.THEME_DATA['static_text'][text].get(
143+
"FONT_SIZE", 10),
144+
font_color=config.THEME_DATA['static_text'][text].get(
145+
"FONT_COLOR", (0, 0, 0)),
146+
background_color=config.THEME_DATA['static_text'][text].get(
147+
"BACKGROUND_COLOR", (255, 255, 255)),
135148
background_image=_get_full_path(config.THEME_DATA['PATH'],
136149
config.THEME_DATA['static_text'][text].get("BACKGROUND_IMAGE",
137150
None)),
138-
align=config.THEME_DATA['static_text'][text].get("ALIGN", "left"),
139-
anchor=config.THEME_DATA['static_text'][text].get("ANCHOR", "lt"),
151+
align=config.THEME_DATA['static_text'][text].get(
152+
"ALIGN", "left"),
153+
anchor=config.THEME_DATA['static_text'][text].get(
154+
"ANCHOR", "lt"),
140155
)
141156

142157

0 commit comments

Comments
 (0)