From d1c8ee16a497566824d579606097e3f2c68c10eb Mon Sep 17 00:00:00 2001 From: Adam Wonak Date: Thu, 24 Jul 2025 08:35:05 -0700 Subject: [PATCH] EXT will reset clocks in MIDI clock mode. Add reset behavior for EXT clock input when MIDI clock source is selected. Fixes: https://git.pinkduck.xyz/awonak/libGravity/issues/22 --- firmware/Gravity/Gravity.ino | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/firmware/Gravity/Gravity.ino b/firmware/Gravity/Gravity.ino index 0a033aa..ebc0fe3 100644 --- a/firmware/Gravity/Gravity.ino +++ b/firmware/Gravity/Gravity.ino @@ -37,10 +37,12 @@ * Shift - hold and rotate encoder to change current selected output channel. * * EXT: - * External clock input. When Gravity is set to INTERNAL clock mode, this - * input is used to reset clocks. + * External clock input. When Gravity is set to INTERNAL or MIDI clock + * source, this input is used to reset clocks. * * CV1: + * External analog input used to provide modulation to any channel parameter. + * * CV2: * External analog input used to provide modulation to any channel parameter. * @@ -155,13 +157,16 @@ void HandleIntClockTick(uint32_t tick) { } void HandleExtClockTick() { - if (gravity.clock.InternalSource()) { - // Use EXT as Reset when internally clocked. - ResetOutputs(); - gravity.clock.Reset(); - } else { - // Register clock tick. - gravity.clock.Tick(); + switch (app.selected_source) { + case Clock::SOURCE_INTERNAL: + case Clock::SOURCE_EXTERNAL_MIDI: + // Use EXT as Reset when not used for clock source. + ResetOutputs(); + gravity.clock.Reset(); + break; + default: + // Register EXT cv clock tick. + gravity.clock.Tick(); } app.refresh_screen = true; }