summaryrefslogtreecommitdiff
path: root/quantum/matrix_common.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-12-27 15:01:51 -0800
committerGitHub <noreply@github.com>2021-12-28 10:01:51 +1100
commitc86baf3ecea618ce42263c06ac5d0922ea8817fa (patch)
tree09b37a42e78e6edfcc603f1b3c1223ca4466e96f /quantum/matrix_common.c
parent2689e360cea0ba6d42cc57134ec28edc69089fce (diff)
[Core] Fix bug and code regression for Split Common (#15603)
Diffstat (limited to 'quantum/matrix_common.c')
-rw-r--r--quantum/matrix_common.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c
index 79f77421e1..5fdc9186fa 100644
--- a/quantum/matrix_common.c
+++ b/quantum/matrix_common.c
@@ -95,24 +95,22 @@ uint8_t matrix_key_count(void) {
95bool matrix_post_scan(void) { 95bool matrix_post_scan(void) {
96 bool changed = false; 96 bool changed = false;
97 if (is_keyboard_master()) { 97 if (is_keyboard_master()) {
98 static bool last_connected = false;
98 matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; 99 matrix_row_t slave_matrix[ROWS_PER_HAND] = {0};
99 if (transport_master_if_connected(matrix + thisHand, slave_matrix)) { 100 if (transport_master_if_connected(matrix + thisHand, slave_matrix)) {
100 for (int i = 0; i < ROWS_PER_HAND; ++i) { 101 changed = memcmp(matrix + thatHand, slave_matrix, sizeof(slave_matrix)) != 0;
101 if (matrix[thatHand + i] != slave_matrix[i]) {
102 matrix[thatHand + i] = slave_matrix[i];
103 changed = true;
104 }
105 }
106 } else {
107 // reset other half if disconnected
108 for (int i = 0; i < ROWS_PER_HAND; ++i) {
109 matrix[thatHand + i] = 0;
110 slave_matrix[i] = 0;
111 }
112 102
103 last_connected = true;
104 } else if (last_connected) {
105 // reset other half when disconnected
106 memset(slave_matrix, 0, sizeof(slave_matrix));
113 changed = true; 107 changed = true;
108
109 last_connected = false;
114 } 110 }
115 111
112 if (changed) memcpy(matrix + thatHand, slave_matrix, sizeof(slave_matrix));
113
116 matrix_scan_quantum(); 114 matrix_scan_quantum();
117 } else { 115 } else {
118 transport_slave(matrix + thatHand, matrix + thisHand); 116 transport_slave(matrix + thatHand, matrix + thisHand);