Skip to content

Commit

Permalink
fix: prevents outbound pairing sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian committed Nov 22, 2023
1 parent bce7388 commit 0cdb97c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions quantum/oryx.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ void oryx_error(uint8_t code) {
void get_pairing_code(keypos_t positions[], int size) {
const char *version = FIRMWARE_VERSION;

// Initialize all positions to {0, 0}
// Initialize all positions to {1, 1}
for (int i = 0; i < size; ++i) {
positions[i].col = 0;
positions[i].row = 0;
positions[i].col = 1;
positions[i].row = 1;
}

// Find the position of '/'
Expand All @@ -30,8 +30,8 @@ void get_pairing_code(keypos_t positions[], int size) {
max_index = (max_index / 2 < size) ? max_index / 2 : size;

for (int i = 0; i < max_index; ++i) {
positions[i].col = version[i * 2] % 4;
positions[i].row = version[i * 2 + 1] % 4;
positions[i].col = version[i * 2] % ORYX_PAIRING_MAX_INDEX + 1;
positions[i].row = version[i * 2 + 1] % ORYX_PAIRING_MAX_INDEX + 1;
}
}

Expand Down
1 change: 1 addition & 0 deletions quantum/oryx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Once the host has paired, it can freely use the commands define in the Oryx_Comm

#define ORYX_PROTOCOL_VERSION = 0x01
#define ORYX_STOP_BIT -2
#define ORYX_PAIRING_MAX_INDEX 3
#define PAIRING_BLINK_STEPS 512
#define PAIRING_BLINK_END PAIRING_BLINK_STEPS * 60
#define PAIRING_SEQUENCE_SIZE 3
Expand Down

0 comments on commit 0cdb97c

Please sign in to comment.