From 6640ee3feeade09646da4df89b8b0957d5faee5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Thu, 12 Sep 2019 01:46:03 +0200 Subject: [PATCH] Added experimental brightness support. Please confirm if that works. --- led-badge-11x44.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/led-badge-11x44.py b/led-badge-11x44.py index 5ccd944..10dcb16 100755 --- a/led-badge-11x44.py +++ b/led-badge-11x44.py @@ -364,7 +364,7 @@ proto_header = ( ) -def header(lengths, speeds, modes, blink, ants): +def header(lengths, speeds, modes, blink, ants, brightness=100): """ lengths[0] is the number of chars of the first text Speeds come in as 1..8, but are needed 0..7 here. @@ -382,6 +382,14 @@ def header(lengths, speeds, modes, blink, ants): m = m + [m[-1]]*(8-len(m)) # repeat last element h = list(proto_header) + + if brightness <= 25: + h[5] = 0x40 + elif brightness <= 50: + h[5] = 0x20 + elif brightness <= 75: + h[5] = 0x10 + for i in range(8): h[6] += b[i]<