From 2d7f0c5e700f58b3f19072aca54b1abe38e8c3f3 Mon Sep 17 00:00:00 2001 From: midilab Date: Sat, 26 Jul 2025 07:57:08 -0300 Subject: [PATCH] prioritizing most called clock state handlers for external sync inside switch case --- src/uClock.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uClock.cpp b/src/uClock.cpp index 45924d3..7e0ade6 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -300,14 +300,6 @@ void uClockClass::handleInternalClock() void uClockClass::handleExternalClock() { switch (clock_state) { - case PAUSED: - break; - - case STARTING: - clock_state = SYNCING; - ext_clock_us = micros(); - break; - case SYNCING: // set clock_mode as started and goes on to calculate the first ext_interval clock_state = STARTED; @@ -333,6 +325,14 @@ void uClockClass::handleExternalClock() ext_interval = (((uint32_t)ext_interval * (uint32_t)PLL_X) + (uint32_t)(256 - PLL_X) * (uint32_t)last_interval) >> 8; } break; + + case PAUSED: + break; + + case STARTING: + clock_state = SYNCING; + ext_clock_us = micros(); + break; } }