summaryrefslogtreecommitdiff
path: root/quantum/oryx.c
diff options
context:
space:
mode:
authorFlorian Didron <0x6664@hey.com>2022-06-22 10:32:32 +0900
committerFlorian Didron <0x6664@hey.com>2022-06-22 10:32:32 +0900
commitd54c6c6b149dbd133669557ee2c5b110e2ee8df9 (patch)
tree1d76586f7eba721065f17ef39ad9c7f20a48d260 /quantum/oryx.c
parent939bcc54225c54d6f698e2d8d4a395163a837a1d (diff)
fix: pairing crash on Ergodox
Diffstat (limited to 'quantum/oryx.c')
-rw-r--r--quantum/oryx.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/quantum/oryx.c b/quantum/oryx.c
index 080846b38f..58b5d5c626 100644
--- a/quantum/oryx.c
+++ b/quantum/oryx.c
@@ -105,19 +105,26 @@ void pairing_init_handler(void) {
raw_hid_send(event, RAW_EPSIZE);
}
-void pairing_validate_handler() {
- bool valid = true;
- uint8_t event[RAW_EPSIZE];
+bool compare_sequences(keypos_t a[PAIRING_SEQUENCE_SIZE], keypos_t b[PAIRING_SEQUENCE_SIZE]) {
+ bool valid = true;
for (uint8_t i = 0; i < PAIRING_SEQUENCE_SIZE; i++) {
- if (keyboard_pairing_sequence[i].row != host_pairing_sequence[i].row) {
+ if (a[i].row != b[i].row) {
valid = false;
break;
}
- if (keyboard_pairing_sequence[i].col != host_pairing_sequence[i].col) {
+ if (a[i].col != b[i].col) {
valid = false;
break;
}
}
+ return valid;
+}
+
+void pairing_validate_handler() {
+
+ uint8_t event[RAW_EPSIZE];
+ bool valid = compare_sequences(keyboard_pairing_sequence, host_pairing_sequence);
+
if (valid == true) {
event[0] = ORYX_EVT_PAIRING_SUCCESS;
rawhid_state.paired = true;
@@ -126,6 +133,7 @@ void pairing_validate_handler() {
event[0] = ORYX_EVT_PAIRING_FAILED;
rawhid_state.paired = false;
}
+
event[1] = ORYX_STOP_BIT;
rawhid_state.pairing = false;
raw_hid_send(event, sizeof(event));
@@ -177,6 +185,7 @@ bool process_record_oryx(uint16_t keycode, keyrecord_t *record) {
host_pairing_sequence[pairing_input_index++] = record->event.key;
pairing_key_input_event();
}
+ wait_ms(1000);
if (pairing_input_index == PAIRING_SEQUENCE_SIZE) {
rawhid_state.pairing = false;
pairing_input_index = 0;