From 1014e371eedbec25d4b28c6b5e171a2e9dd406e9 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Wed, 4 Mar 2026 23:32:57 +0100 Subject: [PATCH] Steps are set in Track section --- SharedState.cpp | 2 +- SharedState.h | 2 +- UIManager.cpp | 43 +++++++++++++++++++++++++------------------ UIThread.cpp | 2 +- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/SharedState.cpp b/SharedState.cpp index 366826d..b51ea59 100644 --- a/SharedState.cpp +++ b/SharedState.cpp @@ -23,12 +23,12 @@ MenuItem menuItems[] = { { "Playback", MENU_ID_PLAYBACK, false, false, 1 }, { "Melody", MENU_ID_MELODY, false, false, 1 }, { "Scale", MENU_ID_SCALE, false, false, 1 }, - { "Steps", MENU_ID_STEPS, false, false, 1 }, { "Tempo", MENU_ID_TEMPO, false, false, 1 }, { "Song Mode", MENU_ID_SONG_MODE, false, false, 1 }, { "Track", MENU_ID_GROUP_TRACK, true, true, 0 }, { "Track", MENU_ID_TRACK_SELECT, false, false, 1 }, { "Mute", MENU_ID_MUTE, false, false, 1 }, + { "Steps", MENU_ID_STEPS, false, false, 1 }, { "Flavour", MENU_ID_FLAVOUR, false, false, 1 }, { "Intensity", MENU_ID_INTENSITY, false, false, 1 }, { "Mutation", MENU_ID_MUTATION, false, false, 1 }, diff --git a/SharedState.h b/SharedState.h index 50d9c9f..b339854 100644 --- a/SharedState.h +++ b/SharedState.h @@ -19,13 +19,13 @@ enum MenuItemID { MENU_ID_PLAYBACK, MENU_ID_MELODY, MENU_ID_SCALE, - MENU_ID_STEPS, MENU_ID_TEMPO, MENU_ID_SONG_MODE, MENU_ID_GROUP_TRACK, MENU_ID_TRACK_SELECT, MENU_ID_MUTE, + MENU_ID_STEPS, MENU_ID_FLAVOUR, MENU_ID_INTENSITY, MENU_ID_MUTATION, diff --git a/UIManager.cpp b/UIManager.cpp index 400a199..476c8c6 100644 --- a/UIManager.cpp +++ b/UIManager.cpp @@ -353,28 +353,35 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, b if(playMode == MODE_POLY) { for(int t=0; t= numSteps[t]) continue; + int col = s; // Each step is a column - int row = t * 2 + (s / NUM_STEPS); - int col = s % NUM_STEPS; - - uint32_t color = 0; - int note = sequence[t][s].note; - - if (note != -1) { - color = getNoteColor(note, !sequence[t][s].accent); - } - - if (isPlaying && s == (playbackStep % numSteps[t])) { - if (trackMute[t]) { - color = COLOR_MUTED_PLAYHEAD; - } else { - color = (note != -1) ? COLOR_PLAYHEAD : COLOR_PLAYHEAD_DIM; + // --- First row of track pair: Notes --- + int note_row = t * 2; + uint32_t note_color = 0; + if (s < currentTrackSteps) { + int note = sequence[t][s].note; + if (note != -1) { + note_color = getNoteColor(note, !sequence[t][s].accent); } } - - pixels.setPixelColor(getPixelIndex(col, row), color); + pixels.setPixelColor(getPixelIndex(col, note_row), note_color); + + // --- Second row of track pair: Steps & Playhead --- + int step_row = t * 2 + 1; + uint32_t step_color = 0; // Off by default for steps > currentTrackSteps + if (s < currentTrackSteps) { + step_color = COLOR_PLAYHEAD_DIM; // It's a valid step + if (isPlaying && (s == (playbackStep % currentTrackSteps))) { + if (trackMute[t]) { + step_color = COLOR_MUTED_PLAYHEAD; + } else { + step_color = COLOR_PLAYHEAD; + } + } + } + pixels.setPixelColor(getPixelIndex(col, step_row), step_color); } } } else { diff --git a/UIThread.cpp b/UIThread.cpp index fd238c6..e576314 100644 --- a/UIThread.cpp +++ b/UIThread.cpp @@ -667,7 +667,7 @@ static void updateLeds() { // It's a TRACK section item (Track, Mute, Flavour, Mutation, Themes) ledDisplayMode = MODE_MONO; } - } else if (local_currentState == UI_EDIT_FLAVOUR || local_currentState == UI_RANDOMIZE_TRACK_EDIT || local_currentState == UI_SCALE_EDIT || local_currentState == UI_SCALE_NOTE_EDIT || local_currentState == UI_SCALE_TRANSPOSE) { + } else if (local_currentState == UI_EDIT_STEPS || local_currentState == UI_EDIT_FLAVOUR || local_currentState == UI_RANDOMIZE_TRACK_EDIT || local_currentState == UI_SCALE_EDIT || local_currentState == UI_SCALE_NOTE_EDIT || local_currentState == UI_SCALE_TRANSPOSE) { // These are entered from TRACK section items ledDisplayMode = MODE_MONO; }