safely initialize onClockPauseCallback and onClockContinueCallback at constructor

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

@ -81,7 +81,6 @@
#include "platforms/software.h" #include "platforms/software.h"
#endif #endif
// //
// Platform specific timer setup/control // Platform specific timer setup/control
// //
@ -136,6 +135,8 @@ uClockClass::uClockClass()
onStepCallback = nullptr; onStepCallback = nullptr;
onClockStartCallback = nullptr; onClockStartCallback = nullptr;
onClockStopCallback = nullptr; onClockStopCallback = nullptr;
onClockPauseCallback = nullptr;
onClockContinueCallback = nullptr;
// initialize reference data // initialize reference data
calculateReferencedata(); calculateReferencedata();
} }
@ -301,9 +302,9 @@ void uClockClass::handleExternalClock()
{ {
switch (clock_state) { switch (clock_state) {
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;
// no break here just go on to calculate our first ext_interval // no break here, just go on to calculate our first ext_interval
case STARTED: case STARTED:
uint32_t now_clock_us = micros(); uint32_t now_clock_us = micros();

Loading…
Cancel
Save