Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with the active step LED #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions Firmware/IoMatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static const uint8_t ledPinArray[12][2] PROGMEM = {
};
//-----------------------------------------------------------
static uint16_t io_ledState=0xfff; //state of the 12 LEDs == activated notes
static uint8_t io_activeStep=2; //current active quantisation step == currently played note
static uint8_t io_activeStep=99; //current active quantisation step == currently played note
static uint16_t io_lastButtonState=0x00;
//-----------------------------------------------------------
void io_init()
Expand Down Expand Up @@ -188,17 +188,20 @@ void io_processLedPipelined()
{
turnAllLedsOff();

if(ledState==io_activeStep)
if ( (io_ledState & (1<<ledState)) > 0)
{
//this step is currently played => set color 1
turnLedOn(ledState,0);
}
else if ( (io_ledState & (1<<ledState)) > 0)
{
//step is active => colour 2
turnLedOn(ledState,1);
if(ledState==io_activeStep)
{
//this step is currently played => set color 1
turnLedOn(ledState,0);
}
else
{
//step is active => colour 2
turnLedOn(ledState,1);
}
}

ledState++;
if(ledState>=12) ledState=0;
};
Expand Down