Skip to content

Commit da65a66

Browse files
committed
Fixes: themes RGB led colors, orientation for rev. B at restart
1 parent d35def8 commit da65a66

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

library/display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def initialize_display(self):
6060
self.lcd.SetBrightness(CONFIG_DATA["display"]["BRIGHTNESS"])
6161

6262
# Set backplate RGB LED color (for supported HW only)
63-
self.lcd.SetBackplateLedColor(THEME_DATA['display']["DISPLAY_RGB_LED"])
63+
self.lcd.SetBackplateLedColor(THEME_DATA['display'].get("DISPLAY_RGB_LED", (255, 255, 255)))
6464

6565
# Set orientation
6666
self.lcd.SetOrientation(_get_theme_orientation())

library/lcd_comm_rev_b.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,21 @@ def InitializeComm(self):
117117
self.Hello()
118118

119119
def Reset(self):
120-
# HW revision B does not implement a command to reset it: clear the screen instead
121-
self.Clear()
120+
# HW revision B does not implement a command to reset it
121+
pass
122122

123123
def Clear(self):
124124
# HW revision B does not implement a Clear command: display a blank image on the whole screen
125+
# Force an orientation in case the screen is currently configured with one different from the theme
126+
backup_orientation = self.orientation
127+
self.SetOrientation(orientation=Orientation.PORTRAIT)
128+
125129
blank = Image.new("RGB", (self.get_width(), self.get_height()), (255, 255, 255))
126130
self.DisplayPILImage(blank)
127131

132+
# Restore orientation
133+
self.SetOrientation(orientation=backup_orientation)
134+
128135
def ScreenOff(self):
129136
# HW revision B does not implement a "ScreenOff" native command: using SetBrightness(0) instead
130137
self.SetBrightness(0)
@@ -148,8 +155,10 @@ def SetBrightness(self, level_user: int = 25):
148155
self.SendCommand(Command.SET_BRIGHTNESS, payload=[level])
149156

150157
def SetBackplateLedColor(self, led_color: Tuple[int, int, int] = (255, 255, 255)):
158+
if isinstance(led_color, str):
159+
led_color = tuple(map(int, led_color.split(', ')))
151160
if self.is_flagship():
152-
self.SendCommand(Command.SET_LIGHTING, payload=led_color)
161+
self.SendCommand(Command.SET_LIGHTING, payload=list(led_color))
153162
else:
154163
logger.info("Only HW revision 'flagship' supports backplate LED color setting")
155164

library/lcd_simulated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def InitializeComm(self):
5252
pass
5353

5454
def Reset(self):
55-
self.Clear()
55+
pass
5656

5757
def Clear(self):
5858
self.SetOrientation(self.orientation)

res/themes/3.5inchTheme2/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ display:
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)
7-
DISPLAY_RGB_LED: [0, 0, 255]
7+
DISPLAY_RGB_LED: 0, 0, 255
88

99
static_images:
1010
# Specify what static images we want to show on the display

res/themes/Cyberpunk/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ display:
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)
7-
DISPLAY_RGB_LED: 0, 0, 255
7+
DISPLAY_RGB_LED: 255, 255, 0
88

99
static_images:
1010
# Specify what static images we want to show on the display

res/themes/Landscape6Grid/theme.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ display:
44
DISPLAY_ORIENTATION: landscape
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)
7-
DISPLAY_RGB_LED: [0, 0, 255]
7+
DISPLAY_RGB_LED: 0, 0, 255
88

99
static_images:
1010
# Specify what static images we want to show on the display

0 commit comments

Comments
 (0)