diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-12-05 15:36:49 +0100 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2022-12-05 15:36:49 +0100 |
commit | dd8d828414583d6993774240d76c2c2782627ef6 (patch) | |
tree | 35cac7a132f8fbab4babea2c7f71218ea1e0939a /NeoRuntime/Runtime/luxcena_neo/strip.py | |
parent | b1b8b9605d804793f557c92e2d7b1f659d8c99f0 (diff) | |
download | Luxcena-Neo-dd8d828414583d6993774240d76c2c2782627ef6.tar.gz Luxcena-Neo-dd8d828414583d6993774240d76c2c2782627ef6.zip |
Do some design improvements
Diffstat (limited to 'NeoRuntime/Runtime/luxcena_neo/strip.py')
-rw-r--r-- | NeoRuntime/Runtime/luxcena_neo/strip.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/NeoRuntime/Runtime/luxcena_neo/strip.py b/NeoRuntime/Runtime/luxcena_neo/strip.py index b1b90ba..b0165c9 100644 --- a/NeoRuntime/Runtime/luxcena_neo/strip.py +++ b/NeoRuntime/Runtime/luxcena_neo/strip.py @@ -121,7 +121,9 @@ class Strip: def _set_brightness(self, value): self.__actual_brightness = value - self.strip.setBrightness(value) + # Logarithmic curve, to try to make the brightness controll feel more natural. + v = int(10**((value-1)/41.11)) + self.strip.setBrightness(v) self.show() def show(self): @@ -147,7 +149,11 @@ class Strip: def set_pixel_color_XY(self, x, y, *color): """Set LED at position n to the provided 24-bit color value (in RGB order). """ - self.set_pixel_color(self.pixelMatrix.get(x, y), *color) + try: + pixel = self.pixelMatrix.get(x, y) + self.set_pixel_color(self.pixelMatrix.get(x, y), *color) + except IndexError as e: + print(f"Pixel outside matrix cannot be set ({x}, {y})") def set_segment_color(self, segment, *color): """Set a whole segment to the provided red, green and blue color. |