prioritizing most called clock state handlers for external sync inside switch case

pull/51/head
midilab 1 day ago
parent b4fff7bebf
commit 2d7f0c5e70
  1. 16
      src/uClock.cpp

@ -300,14 +300,6 @@ void uClockClass::handleInternalClock()
void uClockClass::handleExternalClock() void uClockClass::handleExternalClock()
{ {
switch (clock_state) { switch (clock_state) {
case PAUSED:
break;
case STARTING:
clock_state = SYNCING;
ext_clock_us = micros();
break;
case SYNCING: case SYNCING:
// set clock_mode as started and goes on to calculate the first ext_interval // set clock_mode as started and goes on to calculate the first ext_interval
clock_state = STARTED; 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; ext_interval = (((uint32_t)ext_interval * (uint32_t)PLL_X) + (uint32_t)(256 - PLL_X) * (uint32_t)last_interval) >> 8;
} }
break; break;
case PAUSED:
break;
case STARTING:
clock_state = SYNCING;
ext_clock_us = micros();
break;
} }
} }

Loading…
Cancel
Save