feat(patterns): reverse animation direction via preset n8

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jimmyandCursor committed 2026-05-17 18:32:01 +12:00
1 parent 55a97ac51c
commit 94266d5a7c
11 files changed
+131 -62

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
"""Strip install direction: n5 bit 0 reverses along-strip motion (upside-down wiring)."""
def is_reversed(preset):
return bool(int(getattr(preset, "n5", 0) or 0) & 1)
def led_i(driver, preset, logical_index):
"""Map a logical strip index (0 = pattern start) to a physical pixel index."""
n = int(driver.num_leds)
i = int(logical_index)
if 0 <= i < n and is_reversed(preset):
return n - 1 - i
return i
def signed(preset, value):
v = int(value)
return -v if is_reversed(preset) else v