-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlcd.h
138 lines (101 loc) · 3.04 KB
/
lcd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
char* lcdData[4][4];
char* lcdData_old[4][4];
char rowText1[255];
char rowText2[255];
char rowText3[255];
char rowText4[255];
// I had to increase the freq of i2c in twi.h (inside wire library) to 300hz. i also commented out the delays in there to try and tighten up the response
void setupLCD(){
lcd.init();
lcd.backlight();
lcd.print("bblazeSEQ v" + version);
lcd.setCursor(0,1);
lcd.print("Init...");
delay(500);
lcd.clear();
}
void updateLCDArray(){
char buffer1[255];
char buffer2[255];
char buffer3[255];
char buffer4[255];
char buffer5[255];
if(updateLCD == 1){
// row 1
lcdData[0][0] = "Chan ";
lcdData[0][1] = "Step ";
lcdData[0][2] = "Mode ";
lcdData[0][3] = "Ptch ";
// row 2
sprintf(buffer1, " %d ", currentChannel+1);
lcdData[1][0] = buffer1;
sprintf(buffer2, " %d ", currentStep);
lcdData[1][1] = buffer2;
if (editMode == 0){
lcdData[1][2] = " Play ";
}
if (editMode == 1){
lcdData[1][2] = " Edit ";
}
if (editMode == 2){
lcdData[1][2] = " Rec ";
}
sprintf(buffer3, " %d ", patternData[currentChannel][3][0]);
lcdData[1][3] = buffer3;
// row 3
lcdData[2][0] = "Note ";
lcdData[2][1] = "NNum ";
lcdData[2][2] = "Velo ";
lcdData[2][3] = " ";
// row 4
int noteOnData = patternData[currentChannel][0][currentStep];
switch(noteOnData){
case 0:
lcdData[3][0] = " off ";
break;
case 1:
lcdData[3][0] = " on ";
break;
case 2:
lcdData[3][0] = " hld ";
break;
}
MIDI.read();
sprintf(buffer4, " %d ", patternData[currentChannel][1][currentStep]);
lcdData[3][1] = buffer4 ;
sprintf(buffer5, " %d ",patternData[currentChannel][2][currentStep]);
lcdData[3][2] = buffer5;
lcdData[3][3] = "";
MIDI.read();
sprintf(rowText1, "%s%s%s%s",lcdData[0][0], lcdData[0][1], lcdData[0][2],lcdData[0][3]);
sprintf(rowText2, "%s%s%s%s",lcdData[1][0], lcdData[1][1], lcdData[1][2],lcdData[1][3]);
sprintf(rowText3, "%s%s%s%s",lcdData[2][0], lcdData[2][1], lcdData[2][2],lcdData[2][3]);
sprintf(rowText4, "%s%s%s%s",lcdData[3][0], lcdData[3][1], lcdData[3][2],lcdData[3][3]);
updateLCD = 2;
}
}
void writeToLCD(){
if(startTime - LCDLastUpdated > 1000 && lcdData != lcdData_old && updateLCD == 2){
lcd.setCursor(0,0);
lcd.print(rowText1);
lcd.setCursor(0,1);
MIDI.read();
lcd.print(rowText2);
lcd.setCursor(0,2);
MIDI.read();
lcd.print(rowText3);
lcd.setCursor(0,3);
MIDI.read();
lcd.print(rowText4);
MIDI.read();
for ( int i = 0; i < 4; i++){
lcdData_old[i][0] = lcdData[i][0];
lcdData_old[i][1] = lcdData[i][1];
lcdData_old[i][2] = lcdData[i][2];
lcdData_old[i][3] = lcdData[i][3];
}
MIDI.read();
LCDLastUpdated = millis();
}
updateLCD = 0;
};