diff options
author | Drashna Jaelre <drashna@live.com> | 2021-07-23 18:06:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 18:06:06 -0700 |
commit | 83a0d85f2b1b9d640f866bcb1e1906a77af102f7 (patch) | |
tree | f35da506f89161163593f82014ef181ffc7c57e0 /keyboards/sekigon/grs_70ec/matrix.c | |
parent | e35672169e3e3b9bb9a1454ab57ca403bfc5ca66 (diff) | |
download | qmk_firmware-83a0d85f2b1b9d640f866bcb1e1906a77af102f7.tar.gz qmk_firmware-83a0d85f2b1b9d640f866bcb1e1906a77af102f7.zip |
[Keyboard] Fix split matrix for sekigon grs 70ec (#13672)
Diffstat (limited to 'keyboards/sekigon/grs_70ec/matrix.c')
-rw-r--r-- | keyboards/sekigon/grs_70ec/matrix.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/keyboards/sekigon/grs_70ec/matrix.c b/keyboards/sekigon/grs_70ec/matrix.c index 7e90d99af6..98b2347937 100644 --- a/keyboards/sekigon/grs_70ec/matrix.c +++ b/keyboards/sekigon/grs_70ec/matrix.c @@ -71,11 +71,13 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { return updated; } -void matrix_post_scan(void) { +bool matrix_post_scan(void) { + bool changed = false; if (is_keyboard_master()) { static uint8_t error_count; - if (!transport_master(matrix + thatHand)) { + matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; + if (!transport_master(matrix + thatHand, slave_matrix)) { error_count++; if (error_count > ERROR_DISCONNECT_COUNT) { @@ -83,25 +85,35 @@ void matrix_post_scan(void) { dprintf("Error: disconnect split half\n"); for (int i = 0; i < ROWS_PER_HAND; ++i) { matrix[thatHand + i] = 0; + slave_matrix[i] = 0; } + + changed = true; } } else { error_count = 0; + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + if (matrix[thatHand + i] != slave_matrix[i]) { + matrix[thatHand + i] = slave_matrix[i]; + changed = true; + } + } } matrix_scan_quantum(); } else { - transport_slave(matrix + thisHand); + transport_slave(matrix + thatHand, matrix + thisHand); matrix_slave_scan_user(); } + return changed; } uint8_t matrix_scan(void) { - bool changed = matrix_scan_custom(raw_matrix); + bool changed = matrix_scan_custom(raw_matrix) || matrix_post_scan(); debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed); - matrix_post_scan(); return changed; } |