summaryrefslogtreecommitdiff
path: root/quantum/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/matrix.c')
-rw-r--r--quantum/matrix.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c
index d22817bf48..33586c431b 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -25,10 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "split_common/split_util.h"
# include "split_common/transactions.h"
-# ifndef ERROR_DISCONNECT_COUNT
-# define ERROR_DISCONNECT_COUNT 5
-# endif // ERROR_DISCONNECT_COUNT
-
# define ROWS_PER_HAND (MATRIX_ROWS / 2)
#else
# define ROWS_PER_HAND (MATRIX_ROWS)
@@ -307,33 +303,31 @@ void matrix_init(void) {
}
#ifdef SPLIT_KEYBOARD
+// Fallback implementation for keyboards not using the standard split_util.c
+__attribute__((weak)) bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
+ transport_master(master_matrix, slave_matrix);
+ return true; // Treat the transport as always connected
+}
+
bool matrix_post_scan(void) {
bool changed = false;
if (is_keyboard_master()) {
- static uint8_t error_count;
-
matrix_row_t slave_matrix[ROWS_PER_HAND] = {0};
- if (!transport_master(matrix + thisHand, slave_matrix)) {
- error_count++;
-
- if (error_count > ERROR_DISCONNECT_COUNT) {
- // reset other half if disconnected
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[thatHand + i] = 0;
- slave_matrix[i] = 0;
- }
-
- changed = true;
- }
- } else {
- error_count = 0;
-
+ if (transport_master_if_connected(matrix + thisHand, slave_matrix)) {
for (int i = 0; i < ROWS_PER_HAND; ++i) {
if (matrix[thatHand + i] != slave_matrix[i]) {
matrix[thatHand + i] = slave_matrix[i];
changed = true;
}
}
+ } else {
+ // reset other half if disconnected
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ matrix[thatHand + i] = 0;
+ slave_matrix[i] = 0;
+ }
+
+ changed = true;
}
matrix_scan_quantum();