This commit is contained in:
Dominic DiTaranto 2026-03-17 20:41:15 -04:00
parent 425d8e28f7
commit e9da27c165
2 changed files with 3 additions and 8 deletions

View file

@ -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;

View file

@ -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;
}