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 | |
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.
-rw-r--r-- | quantum/split_common/matrix.c | 29 | ||||
-rw-r--r-- | tmk_core/common/keyboard.c | 13 | ||||
-rw-r--r-- | tmk_core/common/keyboard.h | 3 |
3 files changed, 15 insertions, 30 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 | } |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index aea09169f..a1fbc01da 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
@@ -97,10 +97,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
97 | # include "dip_switch.h" | 97 | # include "dip_switch.h" |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | static uint32_t last_matrix_modification_time = 0; | ||
101 | uint32_t last_matrix_activity_time(void) { return last_matrix_modification_time; } | ||
102 | uint32_t last_matrix_activity_elapsed(void) { return timer_elapsed32(last_matrix_modification_time); } | ||
103 | |||
104 | // Only enable this if console is enabled to print to | 100 | // Only enable this if console is enabled to print to |
105 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) | 101 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) |
106 | static uint32_t matrix_timer = 0; | 102 | static uint32_t matrix_timer = 0; |
@@ -342,8 +338,11 @@ void keyboard_task(void) { | |||
342 | housekeeping_task_kb(); | 338 | housekeeping_task_kb(); |
343 | housekeeping_task_user(); | 339 | housekeeping_task_user(); |
344 | 340 | ||
345 | uint8_t matrix_changed = matrix_scan(); | 341 | #if defined(OLED_DRIVER_ENABLE) && !defined(OLED_DISABLE_TIMEOUT) |
346 | if (matrix_changed) last_matrix_modification_time = timer_read32(); | 342 | uint8_t ret = matrix_scan(); |
343 | #else | ||
344 | matrix_scan(); | ||
345 | #endif | ||
347 | 346 | ||
348 | if (should_process_keypress()) { | 347 | if (should_process_keypress()) { |
349 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { | 348 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
@@ -410,7 +409,7 @@ MATRIX_LOOP_END: | |||
410 | oled_task(); | 409 | oled_task(); |
411 | # ifndef OLED_DISABLE_TIMEOUT | 410 | # ifndef OLED_DISABLE_TIMEOUT |
412 | // Wake up oled if user is using those fabulous keys! | 411 | // Wake up oled if user is using those fabulous keys! |
413 | if (matrix_changed) oled_on(); | 412 | if (ret) oled_on(); |
414 | # endif | 413 | # endif |
415 | #endif | 414 | #endif |
416 | 415 | ||
diff --git a/tmk_core/common/keyboard.h b/tmk_core/common/keyboard.h index cc5b2e5e4..d04e685cd 100644 --- a/tmk_core/common/keyboard.h +++ b/tmk_core/common/keyboard.h | |||
@@ -73,9 +73,6 @@ void keyboard_post_init_user(void); | |||
73 | void housekeeping_task_kb(void); | 73 | void housekeeping_task_kb(void); |
74 | void housekeeping_task_user(void); | 74 | void housekeeping_task_user(void); |
75 | 75 | ||
76 | uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity | ||
77 | uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity | ||
78 | |||
79 | #ifdef __cplusplus | 76 | #ifdef __cplusplus |
80 | } | 77 | } |
81 | #endif | 78 | #endif |