Skip to content

Commit fe499b0

Browse files
committed
Minor fix: use same parameter name for setBrightness across all LcdComm
1 parent da65a66 commit fe499b0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/lcd_comm_rev_b.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ def ScreenOn(self):
140140
# HW revision B does not implement a "ScreenOn" native command: using SetBrightness() instead
141141
self.SetBrightness()
142142

143-
def SetBrightness(self, level_user: int = 25):
144-
assert 0 <= level_user <= 100, 'Brightness level must be [0-100]'
143+
def SetBrightness(self, level: int = 25):
144+
assert 0 <= level <= 100, 'Brightness level must be [0-100]'
145145

146146
if self.is_brightness_range():
147147
# Brightness scales from 0 to 255, with 255 being the brightest and 0 being the darkest.
148148
# Convert our brightness % to an absolute value.
149-
level = int((level_user / 100) * 255)
149+
converted_level = int((level / 100) * 255)
150150
else:
151151
# Brightness is 1 (off) or 0 (full brightness)
152152
logger.info("Your display does not support custom brightness level")
153-
level = 1 if level_user == 0 else 0
153+
converted_level = 1 if level == 0 else 0
154154

155-
self.SendCommand(Command.SET_BRIGHTNESS, payload=[level])
155+
self.SendCommand(Command.SET_BRIGHTNESS, payload=[converted_level])
156156

157157
def SetBackplateLedColor(self, led_color: Tuple[int, int, int] = (255, 255, 255)):
158158
if isinstance(led_color, str):

0 commit comments

Comments
 (0)