- First complete version of firmware. Currently being tested in the rehearsal room

- Added bunch of screens, fonts and images
 - Added script to read out frame buffer (function currently disabled in Firmware)
This commit is contained in:
2025-10-26 20:57:58 +01:00
parent 90bca063e6
commit 89c875e38f
62 changed files with 4668 additions and 489 deletions

View File

@@ -25,7 +25,9 @@
#define NOTE_COLOR_GREEN_ALT NOTE_COLOR_GREEN + 1
#define NOTE_COLOR_BLUE_ALT NOTE_COLOR_BLUE + 1
#define NOTE_COLOR_COUNT_RESET_THRESHOLD_TICKS 100 // 100 * 10 ms -> 1s
#define NOTE_COLOR_COUNT_RESET_THRESHOLD_TICKS (_EEPROM_Content.Channel_MIDI_Configuration[ch].Note_Reset_Timeout * (1000 / TIMER_INTERVALL_LED_UPDATE_ms))
// #define COUNT_APPLIED_NOTES
// ============================================================================================
@@ -37,11 +39,14 @@
volatile bool _MIDI_To_Light_Enabled;
extern volatile EEPROM_Content_t _EEPROM_Content;
volatile Info_Last_Received_Note_t _Info_Last_Received_Note[NUM_LED_CHANNELS];
volatile Info_Last_Received_Note_t _Info_Last_Applied_Note[NUM_LED_CHANNELS];
volatile Pause_Light_Timer_s _Pause_Light_Timer[NUM_LED_CHANNELS];
volatile int _NoteOn_Color_Counter[NUM_LED_CHANNELS][NUM_LED_COLORS];
volatile int _NoteOn_Color_Reset_Counter;
Info_Last_Received_Note_t _Info_Last_Received_Note[NUM_LED_CHANNELS];
Info_Last_Received_Note_t _Info_Last_Applied_Note[NUM_LED_CHANNELS];
volatile Pause_Light_Timer_s _Pause_Light_Timer[NUM_LED_CHANNELS];
volatile int _NoteOn_Color_Counter[NUM_LED_CHANNELS][NUM_LED_COLORS];
volatile int _NoteOn_Color_Reset_Counter;
// 1 LED Channel, 3 LED Colors, 2 Event Types (Note On & Off)
int32_t _Event_Received_Counter[NUM_LED_CHANNELS][NUM_LED_COLORS][2];
static const uint8_t _PWM_Lookup[NUM_LED_COLORS][128] = {
{ // Red
@@ -97,7 +102,7 @@ void Core1_Light_Controller_Init(void)
{
_MIDI_To_Light_Enabled = true;
for(uint ch=0;ch<NUM_LED_CHANNELS;ch++)
for(uint32_t ch=0;ch<NUM_LED_CHANNELS;ch++)
{
_Info_Last_Received_Note[ch].Event = 0;
_Info_Last_Received_Note[ch].Note = NO_NOTE;
@@ -110,6 +115,11 @@ void Core1_Light_Controller_Init(void)
_Info_Last_Applied_Note[ch].Note_In_Octave = NO_NOTE;
_Info_Last_Applied_Note[ch].Velocity = 0;
_Info_Last_Applied_Note[ch].Timestamp_ms = 0;
for(uint32_t col=0;col < NUM_LED_COLORS;col++) {
_Event_Received_Counter[ch][col][MIDI_EVENT_NOTE_OFF - MIDI_EVENT_NOTE_OFF] = 0;
_Event_Received_Counter[ch][col][MIDI_EVENT_NOTE_ON - MIDI_EVENT_NOTE_OFF] = 0;
}
}
Core1_Light_Controller_Reset_NoteOn_Counter();
@@ -146,13 +156,16 @@ void Core1_Light_Controller_Tick(void)
if(_Pause_Light_Timer[ch].Timer < PAUSE_LIGHT_TIMEOUT_TICKS) {
_Pause_Light_Timer[ch].Timer++;
}
}
if(_NoteOn_Color_Reset_Counter < NOTE_COLOR_COUNT_RESET_THRESHOLD_TICKS) {
_NoteOn_Color_Reset_Counter++;
}
else {
Core1_Light_Controller_Reset_NoteOn_Counter();
if(_EEPROM_Content.Channel_MIDI_Configuration[0].Note_Reset_Enabled > 0)
{
if(_NoteOn_Color_Reset_Counter < NOTE_COLOR_COUNT_RESET_THRESHOLD_TICKS) {
_NoteOn_Color_Reset_Counter++;
}
else {
Core1_Light_Controller_Reset_NoteOn_Counter();
}
}
}
}
@@ -217,6 +230,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
Core1_LED_Control_Set_DC_Direct(ch, R, DutyCycle);
_NoteOn_Color_Counter[ch][R]++;
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][R][MIDI_EVENT_NOTE_ON - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else if(midi_note_in_octave == NOTE_COLOR_GREEN || midi_note_in_octave == NOTE_COLOR_GREEN_ALT)
{
@@ -225,6 +242,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
Core1_LED_Control_Set_DC_Direct(ch, G, DutyCycle);
_NoteOn_Color_Counter[ch][G]++;
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][G][MIDI_EVENT_NOTE_ON - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else if(midi_note_in_octave == NOTE_COLOR_BLUE || midi_note_in_octave == NOTE_COLOR_BLUE_ALT)
{
@@ -233,6 +254,10 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
Core1_LED_Control_Set_DC_Direct(ch, B, DutyCycle);
_NoteOn_Color_Counter[ch][B]++;
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][B][MIDI_EVENT_NOTE_ON - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else
{
@@ -244,17 +269,29 @@ void Core1_Light_Controller_MIDI_Full_Note_Received(uint8_t midi_event, uint8_t
if(midi_note_in_octave == NOTE_COLOR_RED || midi_note_in_octave == NOTE_COLOR_RED_ALT)
{
_NoteOn_Color_Counter[ch][R]--;
if(_NoteOn_Color_Counter[ch][R] == 0) { Core1_LED_Control_Set_DC_Direct(ch, R, 0); }
if(_NoteOn_Color_Counter[ch][R] == 0) { Core1_LED_Control_Set_DC_Direct(ch, R, 0); }
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][R][MIDI_EVENT_NOTE_OFF - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else if(midi_note_in_octave == NOTE_COLOR_GREEN || midi_note_in_octave == NOTE_COLOR_GREEN_ALT)
{
_NoteOn_Color_Counter[ch][G]--;
if(_NoteOn_Color_Counter[ch][G] == 0) { Core1_LED_Control_Set_DC_Direct(ch, G, 0); }
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][G][MIDI_EVENT_NOTE_OFF - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else if(midi_note_in_octave == NOTE_COLOR_BLUE || midi_note_in_octave == NOTE_COLOR_BLUE_ALT)
{
_NoteOn_Color_Counter[ch][B]--;
if(_NoteOn_Color_Counter[ch][B] == 0) { Core1_LED_Control_Set_DC_Direct(ch, B, 0); }
#ifdef COUNT_APPLIED_NOTES
_Event_Received_Counter[ch][B][MIDI_EVENT_NOTE_OFF - MIDI_EVENT_NOTE_OFF]++;
#endif
}
else
{
@@ -349,7 +386,7 @@ void Core1_Light_Controller_Pause_Light_Trigger(uint8_t midi_event, uint8_t midi
if(Match_Success) {
if(_Pause_Light_Timer[ch].Is_Active == true)
{
_Pause_Light_Timer[ch].Is_Active = false;
_Pause_Light_Timer[ch].Is_Active = false;
Core1_LED_Control_Set_DC_Direct(ch, R, 0);
Core1_LED_Control_Set_DC_Direct(ch, G, 0);