Fix Tx Bolt ghosting second character on key press (#5229)

* convert tabs to spaces

* fix #4578: don't call gemini protocol code when in bolt mode

Add missing break; statements in switch. The missing break resulted in
a fall through and an additional processing of the gemini code.
This commit is contained in:
Tobias Schulte 2019-02-24 04:32:48 +01:00 committed by Drashna Jaelre
parent 0f62383be5
commit a69e4406d4

View File

@ -114,13 +114,13 @@ static void send_steno_chord(void) {
if (send_steno_chord_user(mode, chord)) { if (send_steno_chord_user(mode, chord)) {
switch(mode) { switch(mode) {
case STENO_MODE_BOLT: case STENO_MODE_BOLT:
send_steno_state(BOLT_STATE_SIZE, false); send_steno_state(BOLT_STATE_SIZE, false);
virtser_send(0); // terminating byte virtser_send(0); // terminating byte
break; break;
case STENO_MODE_GEMINI: case STENO_MODE_GEMINI:
chord[0] |= 0x80; // Indicate start of packet chord[0] |= 0x80; // Indicate start of packet
send_steno_state(GEMINI_STATE_SIZE, true); send_steno_state(GEMINI_STATE_SIZE, true);
break; break;
} }
} }
steno_clear_state(); steno_clear_state();
@ -161,7 +161,7 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QK_STENO_BOLT: case QK_STENO_BOLT:
if (!process_steno_user(keycode, record)) { if (!process_steno_user(keycode, record)) {
return false; return false;
} }
if (IS_PRESSED(record->event)) { if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_BOLT); steno_set_mode(STENO_MODE_BOLT);
@ -170,7 +170,7 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
case QK_STENO_GEMINI: case QK_STENO_GEMINI:
if (!process_steno_user(keycode, record)) { if (!process_steno_user(keycode, record)) {
return false; return false;
} }
if (IS_PRESSED(record->event)) { if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_GEMINI); steno_set_mode(STENO_MODE_GEMINI);
@ -179,25 +179,27 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
case STN__MIN...STN__MAX: case STN__MIN...STN__MAX:
if (!process_steno_user(keycode, record)) { if (!process_steno_user(keycode, record)) {
return false; return false;
} }
switch(mode) { switch(mode) {
case STENO_MODE_BOLT: case STENO_MODE_BOLT:
update_state_bolt(keycode - QK_STENO, IS_PRESSED(record->event)); update_state_bolt(keycode - QK_STENO, IS_PRESSED(record->event));
case STENO_MODE_GEMINI: break;
update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event)); case STENO_MODE_GEMINI:
update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event));
break;
} }
// allow postprocessing hooks // allow postprocessing hooks
if (postprocess_steno_user(keycode, record, mode, chord, pressed)) { if (postprocess_steno_user(keycode, record, mode, chord, pressed)) {
if (IS_PRESSED(record->event)) { if (IS_PRESSED(record->event)) {
++pressed; ++pressed;
} else { } else {
--pressed; --pressed;
if (pressed <= 0) { if (pressed <= 0) {
pressed = 0; pressed = 0;
send_steno_chord(); send_steno_chord();
} }
} }
} }
return false; return false;
} }