From 756eb6a62bc7fbb35e8257953a02bdb6bf0fbeed Mon Sep 17 00:00:00 2001 From: Only Date: Fri, 6 May 2022 13:14:02 +0200 Subject: [PATCH] Add an option to switch between inputs with third key on Waveshare's hat --- visualizer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/visualizer.py b/visualizer.py index 3b6dcf99..25a3aead 100755 --- a/visualizer.py +++ b/visualizer.py @@ -179,8 +179,16 @@ def start_webserver(): time.sleep(0.01) if GPIO.input(KEY3) == 0: midiports.last_activity = time.time() - if ledsettings.sequence_active: + if ledsettings.sequence_active == True: ledsettings.set_sequence(0, 1) + else: + active_input = usersettings.get_setting_value("input_port") + secondary_input = usersettings.get_setting_value("secondary_input_port") + midiports.change_port("inport", secondary_input) + usersettings.change_setting_value("secondary_input_port", active_input) + usersettings.change_setting_value("input_port", secondary_input) + fastColorWipe(ledstrip.strip, True, ledsettings) + while GPIO.input(KEY3) == 0: time.sleep(0.01) if GPIO.input(KEYLEFT) == 0: