diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-01-15 06:55:07 +1100 |
|---|---|---|
| committer | Nick Brassel <nick@tzarc.org> | 2021-01-15 06:55:07 +1100 |
| commit | ab375d3d075c105f09a1ddd0e155f178225518bc (patch) | |
| tree | 89e5ba3ddf9e3bba49759a0ea9cad9565f1ad5d1 /quantum | |
| parent | 4b4445290038d19e2f0b31c293f39628dd77cb12 (diff) | |
| download | qmk_firmware-ab375d3d075c105f09a1ddd0e155f178225518bc.tar.gz qmk_firmware-ab375d3d075c105f09a1ddd0e155f178225518bc.zip | |
Revert "Keep track of last matrix activity (#10730)"
This reverts commit 79d1db332477963555416d9fff82ecac4399bd52.
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/split_common/matrix.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c index 067815c99..22ff89bfc 100644 --- a/quantum/split_common/matrix.c +++ b/quantum/split_common/matrix.c | |||
| @@ -251,59 +251,48 @@ void matrix_init(void) { | |||
| 251 | split_post_init(); | 251 | split_post_init(); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | bool matrix_post_scan(void) { | 254 | void matrix_post_scan(void) { |
| 255 | bool changed = false; | ||
| 256 | if (is_keyboard_master()) { | 255 | if (is_keyboard_master()) { |
| 257 | static uint8_t error_count; | 256 | static uint8_t error_count; |
| 258 | 257 | ||
| 259 | matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; | 258 | if (!transport_master(matrix + thatHand)) { |
| 260 | if (!transport_master(slave_matrix)) { | ||
| 261 | error_count++; | 259 | error_count++; |
| 262 | 260 | ||
| 263 | if (error_count > ERROR_DISCONNECT_COUNT) { | 261 | if (error_count > ERROR_DISCONNECT_COUNT) { |
| 264 | // reset other half if disconnected | 262 | // reset other half if disconnected |
| 265 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 263 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 266 | slave_matrix[i] = 0; | 264 | matrix[thatHand + i] = 0; |
| 267 | } | 265 | } |
| 268 | } | 266 | } |
| 269 | } else { | 267 | } else { |
| 270 | error_count = 0; | 268 | error_count = 0; |
| 271 | } | 269 | } |
| 272 | 270 | ||
| 273 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 274 | if (matrix[thatHand + i] != slave_matrix[i]) { | ||
| 275 | matrix[thatHand + i] = slave_matrix[i]; | ||
| 276 | changed = true; | ||
| 277 | } | ||
| 278 | } | ||
| 279 | |||
| 280 | matrix_scan_quantum(); | 271 | matrix_scan_quantum(); |
| 281 | } else { | 272 | } else { |
| 282 | transport_slave(matrix + thisHand); | 273 | transport_slave(matrix + thisHand); |
| 283 | 274 | ||
| 284 | matrix_slave_scan_user(); | 275 | matrix_slave_scan_user(); |
| 285 | } | 276 | } |
| 286 | |||
| 287 | return changed; | ||
| 288 | } | 277 | } |
| 289 | 278 | ||
| 290 | uint8_t matrix_scan(void) { | 279 | uint8_t matrix_scan(void) { |
| 291 | bool local_changed = false; | 280 | bool changed = false; |
| 292 | 281 | ||
| 293 | #if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) | 282 | #if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) |
| 294 | // Set row, read cols | 283 | // Set row, read cols |
| 295 | for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { | 284 | for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { |
| 296 | local_changed |= read_cols_on_row(raw_matrix, current_row); | 285 | changed |= read_cols_on_row(raw_matrix, current_row); |
| 297 | } | 286 | } |
| 298 | #elif (DIODE_DIRECTION == ROW2COL) | 287 | #elif (DIODE_DIRECTION == ROW2COL) |
| 299 | // Set col, read rows | 288 | // Set col, read rows |
| 300 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | 289 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { |
| 301 | local_changed |= read_rows_on_col(raw_matrix, current_col); | 290 | changed |= read_rows_on_col(raw_matrix, current_col); |
| 302 | } | 291 | } |
| 303 | #endif | 292 | #endif |
| 304 | 293 | ||
| 305 | debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed); | 294 | debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed); |
| 306 | 295 | ||
| 307 | bool remote_changed = matrix_post_scan(); | 296 | matrix_post_scan(); |
| 308 | return (uint8_t)(local_changed || remote_changed); | 297 | return (uint8_t)changed; |
| 309 | } | 298 | } |
