From bcaa78c785a50c4494e27e29af75aabe684e2e1f Mon Sep 17 00:00:00 2001 From: Frederic Date: Mon, 26 Dec 2016 19:05:04 +0100 Subject: [PATCH] added brightness control support, still untested --- blup/output.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/blup/output.py b/blup/output.py index 6837631..0cd809a 100644 --- a/blup/output.py +++ b/blup/output.py @@ -331,10 +331,10 @@ class BLPOutput(Output): # class BlinkenbuntHDOutput(Output): - moduleRegexDesc = 'bbunthd' - moduleRegex = '^bbunthd$' + moduleRegexDesc = 'bbunthd[:BRIGHTNESS]' + moduleRegex = '^bbunthd(:(?P\d+))?$' - def __init__(self): + def __init__(self, brightness): import neopixel self.w = 22 self.h = 16 @@ -342,20 +342,19 @@ class BlinkenbuntHDOutput(Output): LED_PIN = 13 LED_FREQ_HZ = 800000 LED_DMA = 5 - LED_BRIGHTNESS = 50 LED_INVERT = False LED_PWM = 1 self.strip = neopixel.Adafruit_NeoPixel( LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, - LED_BRIGHTNESS, LED_PWM + brightness, LED_PWM ) self.strip.begin() self._color_cls = neopixel.Color @classmethod def fromRegexMatch(cls, regexMatch): - return cls() + return cls(brightness=regexMatch.groupdict().get('brightness', 50)) def sendFrame(self, frame): for y in range(self.h):