main firmware: add variable editing, fix bug with holding
Users can now edit the program variables in order to customize their programs.
This commit is contained in:
@@ -60,7 +60,7 @@ void btn_tick()
|
||||
} else if (btn[i].hold_thresh && (btn[i].held >> BTN_HOLD_SHIFT) >= btn[i].hold_thresh) {
|
||||
// yes, held, but only set if we didn't already
|
||||
if (!(btn[i].state & BTN_HELD)) {
|
||||
btn[i].state = BTN_HELD;
|
||||
btn[i].state |= BTN_HELD;
|
||||
} else if (btn[i].hold_retrig) {
|
||||
// retrigger counter
|
||||
btn[i].hold_rt_ctr++;
|
||||
@@ -102,7 +102,7 @@ void btn_callback()
|
||||
}
|
||||
}
|
||||
|
||||
if ((s & BTN_HELDRT) && !(s & BTN_HELD_CB)) {
|
||||
if ((s & BTN_HELDRT) && !(s & BTN_HELDRT_CB)) {
|
||||
btn[i].state |= BTN_HELDRT_CB;
|
||||
if (btn[i].held_cb) {
|
||||
btn[i].held_cb(i);
|
||||
|
||||
@@ -89,11 +89,17 @@ void ledprog_btn_push_cb(uint8_t idx)
|
||||
if (!prog_mode) return;
|
||||
|
||||
switch (idx) {
|
||||
case BTN_MODE: {
|
||||
|
||||
case BTN_MODE: { // back or down
|
||||
if (!uconf.led[led_prog_active][prog_idx]) {
|
||||
uconf.led[led_prog_active][prog_idx] = 0xff;
|
||||
} else {
|
||||
uconf.led[led_prog_active][prog_idx]--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BTN_SET: {
|
||||
|
||||
case BTN_SET: { // forward or up
|
||||
uconf.led[led_prog_active][prog_idx]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,13 +203,13 @@ void ledprog_btn()
|
||||
btn[BTN_MODE].held_cb = ledprog_btn_held_cb;
|
||||
btn[BTN_MODE].release_cb = ledprog_btn_release_cb;
|
||||
btn[BTN_MODE].hold_thresh = BTN_HOLD_1_00S;
|
||||
btn[BTN_MODE].hold_retrig = 10;
|
||||
btn[BTN_MODE].hold_retrig = 16;
|
||||
|
||||
btn[BTN_SET].push_cb = ledprog_btn_push_cb;
|
||||
btn[BTN_SET].held_cb = ledprog_btn_held_cb;
|
||||
btn[BTN_SET].release_cb = ledprog_btn_release_cb;
|
||||
btn[BTN_SET].hold_thresh = BTN_HOLD_1_00S;
|
||||
btn[BTN_SET].hold_retrig = 10;
|
||||
btn[BTN_SET].hold_retrig = 16;
|
||||
}
|
||||
|
||||
void ledprog_run()
|
||||
|
||||
Reference in New Issue
Block a user