From dfe01e2958304d74476220f9a7e90cc0d5938593 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 7 Dec 2024 13:53:16 +0800 Subject: [PATCH] Fix and build. --- src/handlers.c | 7 +++---- src/include/main.h | 16 ++++++++-------- src/include/user_config.h | 2 +- src/keyboard.c | 4 ++-- src/utils.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index f84b625..3684148 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -339,7 +339,7 @@ void handle_response_byte_msg(uart_packet_t *packet, device_t *state) { /* Neeeeeeext byte, please! */ state->fw.address += sizeof(uint32_t); - state->fw.byte_done = true; + // state->fw.byte_done = true; } /* Process a request to read a firmware package from flash */ @@ -354,9 +354,8 @@ void handle_heartbeat_msg(uart_packet_t *packet, device_t *state) { return; /* It is? Ok, kick off the firmware upgrade */ - // state->fw = (fw_upgrade_state_t) { - state->fw = () { - // .upgrade_in_progress = true, + state->fw = (fw_upgrade_state_t) { + .upgrade_in_progress = true, .byte_done = true, .address = 0, .checksum = 0xffffffff, diff --git a/src/include/main.h b/src/include/main.h index 11b29bb..646f895 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -372,13 +372,13 @@ typedef struct { typedef enum { IDLE, READING_PACKET, PROCESSING_PACKET } receiver_state_t; -// typedef struct { -// uint32_t address; // Address we're sending to the other box -// uint32_t checksum; -// uint16_t version; -// bool byte_done; // Has the byte been successfully transferred -// bool upgrade_in_progress; // True if firmware transfer from the other box is in progress -// } fw_upgrade_state_t; +typedef struct { + uint32_t address; // Address we're sending to the other box + uint32_t checksum; + uint16_t version; + bool byte_done; // Has the byte been successfully transferred + bool upgrade_in_progress; // True if firmware transfer from the other box is in progress +} fw_upgrade_state_t; typedef struct { uint8_t kbd_dev_addr; // Address of the keyboard device @@ -410,7 +410,7 @@ typedef struct { uint32_t dma_tx_channel; // DMA TX channel we're using to send /* Firmware */ - // fw_upgrade_state_t fw; // State of the firmware upgrader + fw_upgrade_state_t fw; // State of the firmware upgrader firmware_metadata_t _running_fw; // RAM copy of running fw metadata bool reboot_requested; // If set, stop updating watchdog uint64_t config_mode_timer; // Counts how long are we to remain in config mode diff --git a/src/include/user_config.h b/src/include/user_config.h index e4ef809..3e711dc 100644 --- a/src/include/user_config.h +++ b/src/include/user_config.h @@ -36,7 +36,7 @@ * * */ -#define HOTKEY_TOGGLE HID_KEY_CAPS_LOCK +#define HOTKEY_TOGGLE KEYBOARD_MODIFIER_RIGHTSHIFT /**================================================== * * ============== Mouse Speed Factor ============== * diff --git a/src/keyboard.c b/src/keyboard.c index 9c9df21..4819a94 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -23,11 +23,11 @@ hotkey_combo_t hotkeys[] = { /* Main keyboard switching hotkey */ - {.modifier = KEYBOARD_MODIFIER_LEFTCTRL, + {.modifier = KEYBOARD_MODIFIER_RIGHTCTRL, .keys = {HOTKEY_TOGGLE}, .key_count = 1, .pass_to_os = false, - .action_handler = &output_toggle_hotkey_handler}, + .action_handler = &output_toggle_hotkey_handler}}; // /* Pressing right ALT + right CTRL toggles the slow mouse mode */ // {.modifier = KEYBOARD_MODIFIER_RIGHTALT | KEYBOARD_MODIFIER_RIGHTCTRL, diff --git a/src/utils.c b/src/utils.c index de8831a..267429f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -150,7 +150,7 @@ void request_byte(device_t *state, uint32_t address) { .data32[0] = address, .type = REQUEST_BYTE_MSG, }; - state->fw.byte_done = false; + // state->fw.byte_done = false; queue_try_add(&global_state.uart_tx_queue, &packet); }