UI: MIDI 44–47 -> Color 2, 48–51 -> Color 1; label 'alternating' as 'alternating pulse'; MIDI note 39 sends 'ap'; fix async UI scheduler usage (no create_task)
This commit is contained in:
@@ -254,7 +254,7 @@ class MidiController:
|
|||||||
36: "alternating_phase",
|
36: "alternating_phase",
|
||||||
37: "o",
|
37: "o",
|
||||||
38: "f",
|
38: "f",
|
||||||
39: "a",
|
39: "ap",
|
||||||
40: "p",
|
40: "p",
|
||||||
41: "r",
|
41: "r",
|
||||||
42: "rd",
|
42: "rd",
|
||||||
@@ -273,17 +273,20 @@ class MidiController:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Failed to POST pattern change: {e}")
|
logging.error(f"Failed to POST pattern change: {e}")
|
||||||
return
|
return
|
||||||
# Color selection notes 44-51 map to color slots 0-7
|
# Color selection notes 44-51 map to color slots and targets
|
||||||
if 44 <= msg.note <= 51:
|
if 44 <= msg.note <= 51:
|
||||||
slot_index = msg.note - 44
|
slot_index = msg.note - 44
|
||||||
# Set the selected slot for the currently chosen target (0=Color1, 1=Color2)
|
# Notes 44-47 → Color 2 (target index 1), 48-51 → Color 1 (target index 0)
|
||||||
self.selected_indices[self.next_selected_target] = slot_index
|
target = 1 if 44 <= msg.note <= 47 else 0
|
||||||
|
self.selected_indices[target] = slot_index
|
||||||
|
# Update indicator to reflect last target used
|
||||||
|
self.next_selected_target = target
|
||||||
if callable(self.on_select_palette_indices):
|
if callable(self.on_select_palette_indices):
|
||||||
try:
|
try:
|
||||||
self.on_select_palette_indices(self.selected_indices)
|
self.on_select_palette_indices(self.selected_indices)
|
||||||
except Exception as _e:
|
except Exception as _e:
|
||||||
logging.debug(f"Failed to persist selected indices: {_e}")
|
logging.debug(f"Failed to persist selected indices: {_e}")
|
||||||
logging.info(f"Set Color {self.next_selected_target+1} to slot {slot_index+1}")
|
logging.info(f"Set Color {target+1} to slot {slot_index+1}")
|
||||||
|
|
||||||
elif msg.type == 'control_change':
|
elif msg.type == 'control_change':
|
||||||
# Handle control change messages
|
# Handle control change messages
|
||||||
@@ -801,7 +804,7 @@ class UIClient:
|
|||||||
"alternating_phase": "alternating\nphase",
|
"alternating_phase": "alternating\nphase",
|
||||||
"off": "off",
|
"off": "off",
|
||||||
"flicker": "flicker",
|
"flicker": "flicker",
|
||||||
"alternating": "alternating",
|
"alternating": "alternating\npulse",
|
||||||
"pulse": "pulse",
|
"pulse": "pulse",
|
||||||
"rainbow": "rainbow",
|
"rainbow": "rainbow",
|
||||||
"radiate": "radiate",
|
"radiate": "radiate",
|
||||||
@@ -819,7 +822,7 @@ class UIClient:
|
|||||||
# Normalize current pattern for highlight (map short codes to long names)
|
# Normalize current pattern for highlight (map short codes to long names)
|
||||||
current_raw = self.midi_controller.current_pattern or self.current_pattern
|
current_raw = self.midi_controller.current_pattern or self.current_pattern
|
||||||
short_to_long = {
|
short_to_long = {
|
||||||
"o": "off", "f": "flicker", "a": "alternating", "p": "pulse",
|
"o": "off", "f": "flicker", "a": "alternating", "ap": "alternating", "p": "pulse",
|
||||||
"r": "rainbow", "rd": "radiate", "sm": "segmented_movement",
|
"r": "rainbow", "rd": "radiate", "sm": "segmented_movement",
|
||||||
}
|
}
|
||||||
current_pattern = short_to_long.get(current_raw, current_raw)
|
current_pattern = short_to_long.get(current_raw, current_raw)
|
||||||
|
Reference in New Issue
Block a user