Skip to content

Commit

Permalink
0.72-9
Browse files Browse the repository at this point in the history
Fix LEDs does not flash.
  • Loading branch information
remov-b4-flight committed Nov 2, 2024
1 parent 16f3e23 commit dbcec21
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Core/Src/EmulateMIDI.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void EmulateMIDI_Init() {
*/
void EmulateMIDI() {
bool isSendMIDIMessage = false;
bool isLEDflash = false;
uint8_t bitpos;
if (queue_isempty(&midi_rx_que) != true) { // Check MIDI CC message received.
CH_VAL rx;
Expand Down Expand Up @@ -148,6 +149,7 @@ void EmulateMIDI() {

prev_note = note;
isPrev_SwPush = true;
isLEDflash = true;
}
} else if (isPrev_SwPush == true) {// Is switch/encoder push released?
//Set 'Note Off' message.
Expand All @@ -174,6 +176,7 @@ void EmulateMIDI() {
} else {
goto rot_stopped_exits;
}
isLEDflash = isSendMIDIMessage;

MIDI_TxMessage.header = MIDI_CC_HEADER;
MIDI_TxMessage.status = MIDI_CC_STATUS;
Expand All @@ -200,15 +203,15 @@ void EmulateMIDI() {
}
//Send MIDI message
if (isSendMIDIMessage == true) {
//Flash LED.
if (isPrev_SwPush == true) {
LED_SetPulse(prof_table[LrScene][bitpos].axis,
prof_table[LrScene][bitpos].color, prof_table[LrScene][bitpos].period);
}
//Send MIDI message via USB.
if (USBD_LL_Transmit(pInstance, MIDI_IN_EP, (uint8_t *)&MIDI_TxMessage, MIDI_MESSAGE_LENGTH) == USBD_OK) {
isSendMIDIMessage = false;
}
}
//Flash LED.
if (isLEDflash == true) {
LED_SetPulse(prof_table[LrScene][bitpos].axis,
prof_table[LrScene][bitpos].color, prof_table[LrScene][bitpos].period);
}

}

0 comments on commit dbcec21

Please sign in to comment.