Light pad bank 2 from page 7, and add factory reset and a pad bank toggle to the editor.

Bank 2's lamp colours come from preset page 7, not page 3, so pad_colours.py
writes there and the editor labels it Bank 2. The factory reset loads the
image MidiSuite uploads for its own reset, and the bank toggle writes the
global-block byte MidiSuite uses to switch banks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Sonnet 5.5 committed 2026-10-21 20:34:34 +13:00
1 parent 63b3129cca
commit 3992744a1d
9 files changed
+239 -113

No files matched your search

+21
View File
@@ -178,6 +178,27 @@ def read_global(link: Link | None = None) -> bytes:
link.close()
def set_bank(bank: int, link: Link | None = None) -> int:
"""Switch the pad bank the way MidiSuite does: one live byte in the
global block. It does not commit; Save keeps whatever the block holds."""
from padeditor.preset import GLOBAL_BANK
if bank not in (0, 1):
raise PadError("pad bank must be 0 or 1")
own = link is None
if link is None:
link = Link()
try:
link.write(GLOBAL_BANK, bytes((bank,)), MEM_GLOBAL)
got = read_global(link)[GLOBAL_BANK]
if got != bank:
raise PadError(f"the pad is on bank {got + 1}, not {bank + 1}")
return bank
finally:
if own:
link.close()
def save_image(desired: bytes, link: Link | None = None, settings: bytes | None = None) -> int:
"""Write differing bytes to the preset and commit them.