Add two sets of colour scenes to the test show and light the pads from them.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b8e6b5f24b
commit
6c060720ee
5 files changed
+7049
-3
No files matched your search
+18
-3
@@ -6,6 +6,7 @@ first. Note messages do not change these lamps. The colour is three
|
||||
bytes in the preset, written over the Private USB port.
|
||||
|
||||
.venv/bin/python scripts/pad_colours.py --xchc --bank 2
|
||||
.venv/bin/python scripts/pad_colours.py --colour-set --bank 2
|
||||
.venv/bin/python scripts/pad_colours.py --dry-run
|
||||
.venv/bin/python scripts/pad_colours.py --clear
|
||||
.venv/bin/python scripts/pad_colours.py --identify
|
||||
@@ -117,6 +118,18 @@ def xchc_colours(clear: bool = False) -> list[tuple[str, bytes]]:
|
||||
return colours
|
||||
|
||||
|
||||
def colour_set(clear: bool = False) -> list[tuple[str, bytes]]:
|
||||
"""The colours of shows/test.qxw in pad order, then the rest of the bank off."""
|
||||
from colour_sets import COLOURS
|
||||
|
||||
colours = []
|
||||
for name, r, g, b, w in COLOURS:
|
||||
rgb = b"\x00\x00\x00" if clear else bytes(scale(c) for c in led_rgb(r, g, b, w))
|
||||
colours.append((name, rgb))
|
||||
colours.extend(("", b"\x00\x00\x00") for _ in range(16 - len(colours)))
|
||||
return colours
|
||||
|
||||
|
||||
# Preset page whose records light each pad bank. Page 3 also sends notes
|
||||
# 52–67 but its colours are not shown; bank 2 takes them from page 7.
|
||||
BANK_PAGE = {1: 2, 2: 7}
|
||||
@@ -208,8 +221,9 @@ def apply(
|
||||
raise SystemExit(f"the pad did not accept the save ({reply.hex()})")
|
||||
print("Saved on the pad.", flush=True)
|
||||
finally:
|
||||
midiout.close_port()
|
||||
midiin.close_port()
|
||||
for port in (midiout, midiin):
|
||||
port.close_port()
|
||||
port.delete()
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
@@ -217,6 +231,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--bank", type=int, default=1, help="pad bank to write (2 is notes 52–67)")
|
||||
parser.add_argument("--page", type=int, help="write preset page 0–7 instead (page 2 is bank 1, 3 is bank 2; 7 repeats 52–67)")
|
||||
parser.add_argument("--xchc", action="store_true", help="use the solid colour scenes from shows/xchc.qxw")
|
||||
parser.add_argument("--colour-set", action="store_true", help="use the 16 colours from shows/test.qxw")
|
||||
parser.add_argument("--clear", action="store_true", help="store black on every scene pad")
|
||||
parser.add_argument("--identify", action="store_true", help="light each pad page in its own colour")
|
||||
parser.add_argument("--dry-run", action="store_true", help="print the colours and do not open a port")
|
||||
@@ -235,7 +250,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
raise SystemExit(str(exc)) from exc
|
||||
print(f"Saved on the pad ({written} bytes changed).")
|
||||
return 0
|
||||
palette = xchc_colours(args.clear) if args.xchc else None
|
||||
palette = xchc_colours(args.clear) if args.xchc else colour_set(args.clear) if args.colour_set else None
|
||||
if args.dry_run:
|
||||
seen = set()
|
||||
for name, address, rgb in colour_writes(args.clear, args.bank, palette):
|
||||
|
||||
Reference in new issue
Block a user