add long-press and repeating

master
Felix Pankratz 2 years ago
parent 664f8e7241
commit 0518c6e382

@ -142,13 +142,11 @@ int32_t metronome_app() {
if(event_status == FuriStatusOk) { if(event_status == FuriStatusOk) {
// press events // press events
if(event.type == EventTypeKey) { if(event.type == EventTypeKey) {
if(event.input.type == InputTypePress) { if(event.input.type == InputTypeShort) {
switch(event.input.key) { switch(event.input.key) {
case InputKeyUp: case InputKeyUp:
increase_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break; break;
case InputKeyDown: case InputKeyDown:
decrease_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break; break;
case InputKeyRight: case InputKeyRight:
increase_bpm(metronome_state, BPM_STEP_SIZE_FINE); increase_bpm(metronome_state, BPM_STEP_SIZE_FINE);
@ -168,6 +166,42 @@ int32_t metronome_app() {
processing = false; processing = false;
break; break;
} }
} else if (event.input.type == InputTypeLong) {
switch(event.input.key) {
case InputKeyUp:
break;
case InputKeyDown:
break;
case InputKeyRight:
increase_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break;
case InputKeyLeft:
decrease_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break;
case InputKeyOk:
break;
case InputKeyBack:
processing = false;
break;
}
} else if (event.input.type == InputTypeRepeat) {
switch(event.input.key) {
case InputKeyUp:
break;
case InputKeyDown:
break;
case InputKeyRight:
increase_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break;
case InputKeyLeft:
decrease_bpm(metronome_state, BPM_STEP_SIZE_COARSE);
break;
case InputKeyOk:
break;
case InputKeyBack:
processing = false;
break;
}
} }
} }
} else { } else {

Loading…
Cancel
Save