Update clock.h to support uClock v2.2.1 and implement external PPQN 4 #3

Merged
awonak merged 5 commits from refs/pull/3/head into main 2025-05-30 03:08:32 +00:00
3 changed files with 52 additions and 15 deletions
Showing only changes of commit 453527c541 - Show all commits

View File

@ -49,6 +49,7 @@ class Clock {
// Set the source of the clock mode.
void SetSource(Source source) {
uClock.stop();
switch (source) {
case SOURCE_INTERNAL:
uClock.setClockMode(uClock.INTERNAL_CLOCK);
@ -56,12 +57,13 @@ class Clock {
case SOURCE_EXTERNAL_PPQN_24:
uClock.setClockMode(uClock.EXTERNAL_CLOCK);
uClock.setInputPPQN(uClock.PPQN_24);
break;
case SOURCE_EXTERNAL_PPQN_4:
uClock.setClockMode(uClock.EXTERNAL_CLOCK);
uClock.setInputPPQN(uClock.PPQN_4);
default:
break;
}
uClock.start();
}
bool ExternalSource() {

View File

@ -157,7 +157,12 @@ void HandleRotate(Direction dir, int val) {
break;
case 1:
app.selected_source = static_cast<Source>((app.selected_source + 1) % SOURCE_LAST);
if (static_cast<Source>(app.selected_source) == 0 && val < 0) {
app.selected_source = static_cast<Source>(SOURCE_LAST - 1);
} else {
app.selected_source = static_cast<Source>((app.selected_source + val) % SOURCE_LAST);
}
gravity.clock.SetSource(app.selected_source);
app.refresh_screen = true;
break;