Shift beat-1 detection to % 4 == 3 (was off by 3 beats); latency 60ms
This commit is contained in:
+3
-3
@@ -21,7 +21,7 @@ UsbMidiTransport midi_transport;
|
|||||||
AppTask controller(&led_driver, &switch_driver, &midi_transport);
|
AppTask controller(&led_driver, &switch_driver, &midi_transport);
|
||||||
ExpressionPedal exp_pedal(4);
|
ExpressionPedal exp_pedal(4);
|
||||||
|
|
||||||
static volatile uint32_t flash_latency = 50; // ms delay to compensate for Loopy Pro rendering
|
static volatile uint32_t flash_latency = 60; // ms delay to compensate for Loopy Pro rendering
|
||||||
|
|
||||||
TaskHandle_t midi_task_handle = NULL;
|
TaskHandle_t midi_task_handle = NULL;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ void midi_task(void* parameter) {
|
|||||||
last_beat = current_beat;
|
last_beat = current_beat;
|
||||||
flash_start = now + flash_latency;
|
flash_start = now + flash_latency;
|
||||||
// Beat 1 (every 4th) = RED, others = WHITE
|
// Beat 1 (every 4th) = RED, others = WHITE
|
||||||
if (current_beat % 4 == 0) {
|
if (current_beat % 4 == 3) {
|
||||||
mux.set_led_color(6, 255, 0, 0);
|
mux.set_led_color(6, 255, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
mux.set_led_color(6, 255, 255, 255);
|
mux.set_led_color(6, 255, 255, 255);
|
||||||
@@ -54,7 +54,7 @@ void midi_task(void* parameter) {
|
|||||||
|
|
||||||
if (flash_start > 0 && now >= flash_start) {
|
if (flash_start > 0 && now >= flash_start) {
|
||||||
mux.show();
|
mux.show();
|
||||||
uint32_t hold = (last_beat % 4 == 0) ? 100 : 50;
|
uint32_t hold = (last_beat % 4 == 3) ? 100 : 50;
|
||||||
uint32_t elapsed = now - flash_start;
|
uint32_t elapsed = now - flash_start;
|
||||||
if (elapsed >= hold) {
|
if (elapsed >= hold) {
|
||||||
mux.set_led_color(6, 20, 20, 20);
|
mux.set_led_color(6, 20, 20, 20);
|
||||||
|
|||||||
Reference in New Issue
Block a user