Skip to content
This repository was archived by the owner on Aug 14, 2022. It is now read-only.

Commit ace6639

Browse files
committed
Oops, forgot to enable Keypad
1 parent 5003cd0 commit ace6639

2 files changed

Lines changed: 47 additions & 111 deletions

File tree

Matrix.ino

Lines changed: 46 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -49,49 +49,52 @@ void setup()
4949

5050
void readKey()
5151
{
52-
// if (KeyPad.scan())
53-
// {
54-
// if (fn_hold)
55-
// {
56-
// if (KeyPad.fn.hold && !flag_leftFN)
57-
// {
58-
// Midi.sendNoteOff(0, keymap_fn[current_keymap], 0);
59-
// UI.enterFNmenu();
60-
// flag_leftFN = true; //Prevent back to FN
61-
// }
62-
// else if (KeyPad.fn.state == PRESSED)
63-
// {
64-
// Midi.sendNoteOn(0, keymap_fn[current_keymap], 127);
65-
// }
66-
// else if (KeyPad.fn.state == RELEASED)
67-
// {
68-
// Midi.sendNoteOff(0, keymap_fn[current_keymap], 0);
69-
// flag_leftFN = false;
70-
// }
71-
// }
72-
// else
73-
// {
74-
// if (KeyPad.fn.state == PRESSED)
75-
// UI.enterFNmenu();
76-
// }
52+
if (KeyPad.scan())
53+
{
54+
if (fn_hold)
55+
{
56+
if (KeyPad.fn.hold && !flag_leftFN)
57+
{
58+
Midi.sendNoteOff(0, keymap_fn[current_keymap], 0);
59+
UI.enterFNmenu();
60+
flag_leftFN = true; //Prevent back to FN
61+
}
62+
else if (KeyPad.fn.state == PRESSED)
63+
{
64+
Midi.sendNoteOn(0, keymap_fn[current_keymap], 127);
65+
}
66+
else if (KeyPad.fn.state == RELEASED)
67+
{
68+
Midi.sendNoteOff(0, keymap_fn[current_keymap], 0);
69+
flag_leftFN = false;
70+
}
71+
}
72+
else
73+
{
74+
if (KeyPad.fn.state == PRESSED)
75+
UI.enterFNmenu();
76+
}
7777

78-
// for (u8 i = 0; i < MULTIPRESS; i++)
79-
// {
80-
// if (KeyPad.changelist[i] == 0xFFFF)
81-
// break;
82-
// u8 x = xytox(KeyPad.changelist[i]);
83-
// u8 y = xytoy(KeyPad.changelist[i]);
84-
// if (KeyPad.getKey(KeyPad.changelist[i]).state == PRESSED)
85-
// {
86-
// Midi.sendXYon(KeyPad.changelist[i], KeyPad.getKey(KeyPad.changelist[i]).velocity * 127);
87-
// }
88-
// else if (KeyPad.getKey(KeyPad.changelist[i]).state == RELEASED)
89-
// {
90-
// Midi.sendXYoff(KeyPad.changelist[i], 0);
91-
// }
92-
// }
93-
// }
94-
if (Touch.scan())
78+
for (u8 i = 0; i < MULTIPRESS; i++)
79+
{
80+
if (KeyPad.changelist[i] == 0xFFFF)
81+
break;
82+
u8 x = xytox(KeyPad.changelist[i]);
83+
u8 y = xytoy(KeyPad.changelist[i]);
84+
if (KeyPad.getKey(KeyPad.changelist[i]).state == PRESSED)
85+
{
86+
Midi.sendXYon(KeyPad.changelist[i], KeyPad.getKey(KeyPad.changelist[i]).velocity * 127);
87+
}
88+
else if (KeyPad.getKey(KeyPad.changelist[i]).state == RELEASED)
89+
{
90+
Midi.sendXYoff(KeyPad.changelist[i], 0);
91+
}
92+
}
93+
}
94+
}
95+
void readTouch()
96+
{
97+
if (Touch.scan())
9598
{
9699
switch(touch_mode)
97100
{
@@ -121,65 +124,6 @@ void readKey()
121124
}
122125
}
123126
}
124-
// void readTouch()
125-
// {
126-
// if(TouchBar.scan())
127-
// {
128-
// for(u8 x = 0; x < 8; x++)
129-
// {
130-
// switch(TouchBar.changelist[x].kstate)
131-
// {
132-
// case IDLE:
133-
// return;
134-
//
135-
// case PRESSED:
136-
// Midi.sendNoteOn(0, touch_keymap[current_keymap][x], 127);
137-
// break;
138-
//
139-
// case RELEASED:
140-
// Midi.sendNoteOff(0, touch_keymap[current_keymap][x], 0);
141-
// break;
142-
// }
143-
// }
144-
// }
145-
// }
146-
147-
// void factoryTest()
148-
// {
149-
// u32 testcolor[] = {0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0x00FFFF};
150-
//
151-
// for(int i = 0; i < 6; i ++)
152-
// {
153-
// LED.fill(testcolor[i]);
154-
// LED.update();
155-
// while(!KeyPad.scan()){}
156-
//
157-
// while(KeyPad.fnChanged && KeyPad.fn)
158-
// {
159-
// if (mainTimer.tick(1000/fps))
160-
// {
161-
// KeyPad.scan();
162-
// for(int i = 0; i < MULTIPRESS; i++)
163-
// {
164-
// if(KeyPad.list[i].velocity > 128)
165-
// break;
166-
// if(KeyPad.list[i].velocity > 0)
167-
// {
168-
// if(LED.readXYLED(KeyPad.list[i].xy) != testcolor[i])
169-
// {
170-
// LED.setXYCRGB(KeyPad.list[i].xy, testcolor[i]);
171-
// }
172-
// else
173-
// {
174-
// LED.offXY(KeyPad.list[i].xy);
175-
// }
176-
// }
177-
// }
178-
// LED.update();
179-
// }
180-
// }
181-
// }
182-
// }
183127

184128
void loop()
185129
{
@@ -194,21 +138,13 @@ void loop()
194138
if (keypadTimer.tick(keypad_scanrate_micros))
195139
{
196140
readKey();
197-
//readTouch();
141+
readTouch();
198142
}
199143

200144
if (ledTimer.tick(fps_micros))
201145
{
202-
// readKey();
203146
LED.update();
204147
LED.changed = false;
205148
Midi.offScan();
206-
// #ifdef DEBUG
207-
// microTimer.recordCurrent();
208-
// #endif
209-
//LED.update();
210-
// #ifdef DEBUG
211-
// CompositeSerial.println(microTimer.sinceLastTick());
212-
// #endif
213149
}
214150
}

src/Parameter/MatrixVariable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ extern u32 fn_keymap_active_color[5][2][XSIZE]{{{0x00FFFFFF, 0x00FFFFFF, 0x00FFF
409409

410410
extern float velocity_threshold = 0;
411411
extern float aftertouch_threshold = 0;
412-
extern u16 debounce_threshold = 0;
412+
extern u16 debounce_threshold = 24;
413413

414414
//TouchBar
415415
extern u8 touch_mode = 0;

0 commit comments

Comments
 (0)