Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Fix split matrix for sekigon grs 70ec #13672

Merged
merged 1 commit into from
Jul 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions keyboards/sekigon/grs_70ec/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,49 @@ 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) {
// reset other half if disconnected
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;
}