Skip to content

Commit

Permalink
h/fix: slight delay before sending webhid layer change event
Browse files Browse the repository at this point in the history
  • Loading branch information
fdidron committed Jan 15, 2024
1 parent 99a0c79 commit 7e8b2db
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions quantum/oryx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

rawhid_state_t rawhid_state = {.paired = false, .rgb_control = false};

uint8_t pairing_input_index = 0;
uint8_t pairing_input_index = 0;

void oryx_error(uint8_t code) {
uint8_t event[RAW_EPSIZE];
Expand All @@ -26,24 +26,24 @@ void oryx_layer_event(void) {
}

void pairing_failed_event(void) {
rawhid_state.paired = false;
rawhid_state.paired = false;
uint8_t event[RAW_EPSIZE];
event[0] = ORYX_EVT_PAIRING_FAILED;
event[1] = ORYX_STOP_BIT;
raw_hid_send(event, sizeof(event));
}

void pairing_success_event(void) {
rawhid_state.paired = true;
rawhid_state.paired = true;
uint8_t event[RAW_EPSIZE];
event[0] = ORYX_EVT_PAIRING_SUCCESS;
event[1] = ORYX_STOP_BIT;
raw_hid_send(event, sizeof(event));
}

void raw_hid_receive(uint8_t *data, uint8_t length) {
uint8_t command = data[0];
uint8_t *param = &data[1];
uint8_t command = data[0];
uint8_t *param = &data[1];

switch (command) {
case ORYX_CMD_GET_FW_VERSION: {
Expand Down Expand Up @@ -165,7 +165,6 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
}
}


bool process_record_oryx(uint16_t keycode, keyrecord_t *record) {
// While paired, the keyboard sends keystrokes positions to the host
if (rawhid_state.paired == true) {
Expand All @@ -181,9 +180,7 @@ bool process_record_oryx(uint16_t keycode, keyrecord_t *record) {

void layer_state_set_oryx(layer_state_t state) {
if (rawhid_state.paired) {
#ifdef PROTOCOL_LUFA
wait_ms(50);
#endif
uint8_t event[RAW_EPSIZE];
event[0] = ORYX_EVT_LAYER;
event[1] = get_highest_layer(state);
Expand Down

0 comments on commit 7e8b2db

Please sign in to comment.