Cleanup code and debug messages

master
Jacopo De Simoi 1 year ago
parent 0b8243b220
commit 6a3616c016
  1. 17
      src/keyboard.c

@ -536,7 +536,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
kbd->delayedphase = 3; // resolve the delay kbd->delayedphase = 3; // resolve the delay
if (!pressed && code == kbd->delayedcode0) { if (!pressed && code == kbd->delayedcode0) {
// this is the whole point of the delayed business // this is the whole point of the delayed business
dbg("supposedly not wanting to use it as a mod");
kbd->keyfrozenstate[kbd->delayedcode0] = 1; kbd->keyfrozenstate[kbd->delayedcode0] = 1;
process_descriptor(kbd, kbd->delayedcode0, process_descriptor(kbd, kbd->delayedcode0,
&kbd->delayeddescriptor0, dl, 1, time); &kbd->delayeddescriptor0, dl, 1, time);
@ -717,7 +716,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
break; break;
case OP_OVERLOAD_HACK: case OP_OVERLOAD_HACK:
dbg("overload_hack");
idx = d->args[0].idx; // This is the overloaded layer idx = d->args[0].idx; // This is the overloaded layer
action = &kbd->config.descriptors[d->args[1].idx]; action = &kbd->config.descriptors[d->args[1].idx];
// This is the key to press, or the action to perform // This is the key to press, or the action to perform
@ -729,7 +727,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
// record that we are pretending this key is a regular key so // record that we are pretending this key is a regular key so
// that we do not get confused on release // that we do not get confused on release
// how do I capture that? // how do I capture that?
dbg("here we should implement the hack %d", code);
kbd->keyhackstate[code]=1; kbd->keyhackstate[code]=1;
// pretend it is a regular keypress // pretend it is a regular keypress
process_descriptor(kbd, code, action, dl, 1, time); process_descriptor(kbd, code, action, dl, 1, time);
@ -769,33 +766,28 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
break; break;
case OP_OVERLOAD_DELAYED: //At the moment this is just a copy of case OP_OVERLOAD_DELAYED: //At the moment this is just a copy of
//overload //overload
dbg("overload_delayed - got here");
idx = d->args[0].idx; idx = d->args[0].idx;
action = &kbd->config.descriptors[d->args[1].idx]; action = &kbd->config.descriptors[d->args[1].idx];
if (pressed && kbd->delayedphase == 0) { if (pressed && kbd->delayedphase == 0) {
dbg("overload_delayed - initial press");
kbd->delayedcode0 = code; kbd->delayedcode0 = code;
kbd->delayeddescriptor0 = *d; kbd->delayeddescriptor0 = *d;
kbd->delayedphase = 1; kbd->delayedphase = 1;
} else if (pressed) { } else if (pressed) {
dbg("overload_delayed - press");
if (kbd->keyfrozenstate[code]) { if (kbd->keyfrozenstate[code]) {
dbg("overload_delayed - frozen press");
// pressed while frozen; pretend it is the action // pressed while frozen; pretend it is the action
process_descriptor(kbd, code, action, dl, 1, time); process_descriptor(kbd, code, action, dl, 1, time);
kbd->keyfrozenstate[code] = 0; kbd->keyfrozenstate[code] = 0;
} else { } else { // pressed but not frozen
kbd->overload_start_time = time; kbd->overload_start_time = time;
activate_layer(kbd, code, idx); activate_layer(kbd, code, idx);
update_mods(kbd, -1, 0); update_mods(kbd, -1, 0);
} }
} else { } else { // not pressed
if (kbd->keyfrozenstate [code]) { if (kbd->keyfrozenstate [code]) { // frozen
dbg("overload_delayed - frozen release");
// released while frozen, pretend it is the action // released while frozen, pretend it is the action
process_descriptor(kbd, code, action, dl, 0, time); process_descriptor(kbd, code, action, dl, 0, time);
kbd->keyfrozenstate[code] = 0; kbd->keyfrozenstate[code] = 0;
} else { } else { // not frozen
deactivate_layer(kbd, idx); deactivate_layer(kbd, idx);
update_mods(kbd, -1, 0); update_mods(kbd, -1, 0);
@ -816,7 +808,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
} }
} }
} }
break; break;
case OP_ONESHOTM: case OP_ONESHOTM:
case OP_ONESHOT: case OP_ONESHOT:

Loading…
Cancel
Save