Revert "Keep track of last matrix activity (#10730)"
This reverts commit 79d1db3324
.
This commit is contained in:
parent
4b44452900
commit
ab375d3d07
3 changed files with 15 additions and 30 deletions
|
@ -251,59 +251,48 @@ void matrix_init(void) {
|
||||||
split_post_init();
|
split_post_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool matrix_post_scan(void) {
|
void matrix_post_scan(void) {
|
||||||
bool changed = false;
|
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
static uint8_t error_count;
|
static uint8_t error_count;
|
||||||
|
|
||||||
matrix_row_t slave_matrix[ROWS_PER_HAND] = {0};
|
if (!transport_master(matrix + thatHand)) {
|
||||||
if (!transport_master(slave_matrix)) {
|
|
||||||
error_count++;
|
error_count++;
|
||||||
|
|
||||||
if (error_count > ERROR_DISCONNECT_COUNT) {
|
if (error_count > ERROR_DISCONNECT_COUNT) {
|
||||||
// reset other half if disconnected
|
// reset other half if disconnected
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
slave_matrix[i] = 0;
|
matrix[thatHand + i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_count = 0;
|
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();
|
matrix_scan_quantum();
|
||||||
} else {
|
} else {
|
||||||
transport_slave(matrix + thisHand);
|
transport_slave(matrix + thisHand);
|
||||||
|
|
||||||
matrix_slave_scan_user();
|
matrix_slave_scan_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void) {
|
uint8_t matrix_scan(void) {
|
||||||
bool local_changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
|
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
|
||||||
// Set row, read cols
|
// Set row, read cols
|
||||||
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
|
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
|
||||||
local_changed |= read_cols_on_row(raw_matrix, current_row);
|
changed |= read_cols_on_row(raw_matrix, current_row);
|
||||||
}
|
}
|
||||||
#elif (DIODE_DIRECTION == ROW2COL)
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
// Set col, read rows
|
// Set col, read rows
|
||||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||||
local_changed |= read_rows_on_col(raw_matrix, current_col);
|
changed |= read_rows_on_col(raw_matrix, current_col);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed);
|
debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed);
|
||||||
|
|
||||||
bool remote_changed = matrix_post_scan();
|
matrix_post_scan();
|
||||||
return (uint8_t)(local_changed || remote_changed);
|
return (uint8_t)changed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,10 +97,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# include "dip_switch.h"
|
# include "dip_switch.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint32_t last_matrix_modification_time = 0;
|
|
||||||
uint32_t last_matrix_activity_time(void) { return last_matrix_modification_time; }
|
|
||||||
uint32_t last_matrix_activity_elapsed(void) { return timer_elapsed32(last_matrix_modification_time); }
|
|
||||||
|
|
||||||
// Only enable this if console is enabled to print to
|
// Only enable this if console is enabled to print to
|
||||||
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
||||||
static uint32_t matrix_timer = 0;
|
static uint32_t matrix_timer = 0;
|
||||||
|
@ -342,8 +338,11 @@ void keyboard_task(void) {
|
||||||
housekeeping_task_kb();
|
housekeeping_task_kb();
|
||||||
housekeeping_task_user();
|
housekeeping_task_user();
|
||||||
|
|
||||||
uint8_t matrix_changed = matrix_scan();
|
#if defined(OLED_DRIVER_ENABLE) && !defined(OLED_DISABLE_TIMEOUT)
|
||||||
if (matrix_changed) last_matrix_modification_time = timer_read32();
|
uint8_t ret = matrix_scan();
|
||||||
|
#else
|
||||||
|
matrix_scan();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (should_process_keypress()) {
|
if (should_process_keypress()) {
|
||||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
||||||
|
@ -410,7 +409,7 @@ MATRIX_LOOP_END:
|
||||||
oled_task();
|
oled_task();
|
||||||
# ifndef OLED_DISABLE_TIMEOUT
|
# ifndef OLED_DISABLE_TIMEOUT
|
||||||
// Wake up oled if user is using those fabulous keys!
|
// Wake up oled if user is using those fabulous keys!
|
||||||
if (matrix_changed) oled_on();
|
if (ret) oled_on();
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,6 @@ void keyboard_post_init_user(void);
|
||||||
void housekeeping_task_kb(void);
|
void housekeeping_task_kb(void);
|
||||||
void housekeeping_task_user(void);
|
void housekeeping_task_user(void);
|
||||||
|
|
||||||
uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity
|
|
||||||
uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue