diff --git a/src/uClock.cpp b/src/uClock.cpp index a22bc56..b4a8572 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -166,8 +166,8 @@ void uClockClass::pause() void uClockClass::setTimerTempo(float bpm) { // 96 ppqn resolution - tick_us_interval = (60000000 / 24 / bpm); - tick_hertz_interval = 1/((float)tick_us_interval/1000000); + uint32_t tick_us_interval = (60000000 / 24 / bpm); + float tick_hertz_interval = 1/((float)tick_us_interval/1000000); #if defined(ARDUINO_ARCH_AVR) uint32_t ocr; @@ -221,9 +221,12 @@ void uClockClass::setTempo(float bpm) return; } - setTimerTempo(bpm); + ATOMIC( + tempo = bpm + ) - tempo = bpm; + setTimerTempo(tempo); + } float inline uClockClass::freqToBpm(uint32_t freq) diff --git a/src/uClock.h b/src/uClock.h index 46c667d..59a56b8 100755 --- a/src/uClock.h +++ b/src/uClock.h @@ -84,9 +84,6 @@ class uClockClass { uint32_t last_interval; uint32_t sync_interval; - uint32_t tick_us_interval; - float tick_hertz_interval; - float tempo; uint32_t start_timer; uint8_t mode;