diff options
Diffstat (limited to 'NeoRuntime/Runtime')
-rw-r--r-- | NeoRuntime/Runtime/luxcena_neo/strip.py | 10 | ||||
-rw-r--r-- | NeoRuntime/Runtime/neo_runtime.py | 6 |
2 files changed, 13 insertions, 3 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. diff --git a/NeoRuntime/Runtime/neo_runtime.py b/NeoRuntime/Runtime/neo_runtime.py index 7733a4b..c577444 100644 --- a/NeoRuntime/Runtime/neo_runtime.py +++ b/NeoRuntime/Runtime/neo_runtime.py @@ -204,7 +204,11 @@ class NeoRuntime: def __module_loop(self): - self.__module_entry_instance.on_start() + try: + self.__module_entry_instance.on_start() + except Exception as e: + traceback.print_exc() + sys.exit(1) self.__module_last_tick = time.perf_counter() self.__module_last_second = time.perf_counter() |