From e9da27c165d085ff70faf21caa5c8db171f90f5f Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Tue, 17 Mar 2026 20:41:15 -0400 Subject: [PATCH] cleanup --- src/Gate.cpp | 4 ---- src/main.cpp | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Gate.cpp b/src/Gate.cpp index a280dea..370d997 100644 --- a/src/Gate.cpp +++ b/src/Gate.cpp @@ -298,7 +298,6 @@ void Gate::update() { (uint32_t)((float)this->tickInterval * (effectiveWidth / 100.0f)); this->stopTick = startTick + modulatedTicks; - // Only kill the gate if width is strictly less than 100% if (effectiveWidth < 100.0f) { if (MASTER_TICK >= stopTick) { state = 0; @@ -322,8 +321,6 @@ void Gate::update() { if (subTick > 0.99f) subTick = 0.99f; - // If width is 100%, calculate phase based on the WHOLE interval. - // If width < 100%, calculate phase based on the PULSE duration. float elapsedTicks = (float)(MASTER_TICK - startTick) + subTick; float totalDurationTicks = (effectiveWidth >= 100.0f) ? (float)tickInterval @@ -334,7 +331,6 @@ void Gate::update() { float phase = elapsedTicks / totalDurationTicks; - // Keep phase looping if at 100% width if (effectiveWidth >= 100.0f) { while (phase >= 1.0f) phase -= 1.0f; diff --git a/src/main.cpp b/src/main.cpp index c9f8130..d812bbe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -246,7 +246,6 @@ void setup_ins() { gpio_init(IN_CLK_PIN); gpio_set_dir(IN_CLK_PIN, GPIO_IN); gpio_pull_down(IN_CLK_PIN); - // Add to existing callback gpio_set_irq_enabled(IN_CLK_PIN, GPIO_IRQ_EDGE_RISE, true); // SETUP CV INS @@ -341,7 +340,7 @@ int main() { EXTERNAL_CLOCK = false; BPM = globalSettings.bpm; filteredBPM = (float)BPM; - update_period(); // Re-engages internal bpm_timer + update_period(); printf("Clock Lost. Internal BPM Resumed.\n"); } @@ -350,10 +349,10 @@ int main() { static uint8_t last_ppqn_idx = 0xFF; if (EXTPPQNIdx != last_ppqn_idx) { - MASTER_TICK = 0; // Reset to start of bar + MASTER_TICK = 0; for (Gate *g : outputs) { g->lastTriggerTick = 0xFFFFFFFF; - g->state = 0; // Kill any stuck gates + g->state = 0; } last_ppqn_idx = EXTPPQNIdx; }