From 94fa429e26d85aa2e9ceebe5d620d1f90b6d2dd0 Mon Sep 17 00:00:00 2001 From: midilab Date: Fri, 21 Aug 2020 07:17:00 -0300 Subject: [PATCH] avoid calc time based on interval on internal clock --- src/uClock.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/uClock.cpp b/src/uClock.cpp index 8492306..44e284a 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -138,6 +138,8 @@ void uClockClass::setTempo(uint16_t bpm) _tmpSREG = SREG; cli(); tempo = bpm; + // 4 is good for usb-to-midi hid + // 11 is good for native 31400bps midi interface //interval = 62500 / (tempo * 24 / 60) - 4; interval = (uint16_t)(156250 / tempo) - 4; SREG = _tmpSREG; @@ -145,7 +147,10 @@ void uClockClass::setTempo(uint16_t bpm) uint16_t uClockClass::getTempo() { - return (156250 / interval); + if (mode == EXTERNAL_CLOCK) { + tempo = (156250 / interval); + } + return tempo; } uint8_t uClockClass::getMode()