diff --git a/CMakeLists.txt b/CMakeLists.txt index 97f1ef3..8e90c59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.6) set(VERSION_MAJOR 00) -set(VERSION_MINOR 157) +set(VERSION_MINOR 158) set(PICO_SDK_FETCH_FROM_GIT off) set(PICO_BOARD=pico) diff --git a/src/handlers.c b/src/handlers.c index fef3723..307a4f0 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -68,9 +68,9 @@ void switchlock_hotkey_handler(device_t *state, hid_keyboard_report_t *report) { } /* This key combo toggles gaming mode */ -void toggle_relative_mode_handler(device_t *state, hid_keyboard_report_t *report) { - state->relative_mouse ^= 1; - send_value(state->relative_mouse, RELATIVE_MODE_MSG); +void toggle_gaming_mode_handler(device_t *state, hid_keyboard_report_t *report) { + state->gaming_mode ^= 1; + send_value(state->gaming_mode, GAMING_MODE_MSG); }; /* This key combo locks both outputs simultaneously */ @@ -229,9 +229,9 @@ void handle_proxy_msg(uart_packet_t *packet, device_t *state) { queue_packet(&packet->data[1], (enum packet_type_e)packet->data[0], PACKET_DATA_LENGTH - 1); } -/* Process request to reboot the board */ -void handle_toggle_relative_msg(uart_packet_t *packet, device_t *state) { - state->relative_mouse = packet->data[0]; +/* Process relative mouse command */ +void handle_toggle_gaming_msg(uart_packet_t *packet, device_t *state) { + state->gaming_mode = packet->data[0]; } /* Process api communication messages */ diff --git a/src/include/main.h b/src/include/main.h index 20946e6..dc6882d 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -124,7 +124,7 @@ enum packet_type_e { FLASH_LED_MSG = 9, WIPE_CONFIG_MSG = 10, HEARTBEAT_MSG = 12, - RELATIVE_MODE_MSG = 13, + GAMING_MODE_MSG = 13, CONSUMER_CONTROL_MSG = 14, SYSTEM_CONTROL_MSG = 15, SAVE_CONFIG_MSG = 18, @@ -185,7 +185,6 @@ typedef struct { /********* Screen **********/ #define MIN_SCREEN_COORD 0 #define MAX_SCREEN_COORD 32767 -#define SCREEN_MIDPOINT 16384 /********* Configuration storage definitions **********/ @@ -424,6 +423,7 @@ typedef struct { bool switch_lock; // True when device is prevented from switching bool onboard_led_state; // True when LED is ON bool relative_mouse; // True when relative mouse mode is used + bool gaming_mode; // True when gaming mode is on (relative passthru + lock) bool config_mode_active; // True when config mode is active bool digitizer_active; // True when digitizer Win/Mac workaround is active @@ -534,7 +534,7 @@ void fw_upgrade_hotkey_handler_B(device_t *, hid_keyboard_report_t *); void mouse_zoom_hotkey_handler(device_t *, hid_keyboard_report_t *); void all_keys_released_handler(device_t *); void switchlock_hotkey_handler(device_t *, hid_keyboard_report_t *); -void toggle_relative_mode_handler(device_t *, hid_keyboard_report_t *); +void toggle_gaming_mode_handler(device_t *, hid_keyboard_report_t *); void screenlock_hotkey_handler(device_t *, hid_keyboard_report_t *); void output_config_hotkey_handler(device_t *, hid_keyboard_report_t *); void wipe_config_hotkey_handler(device_t *, hid_keyboard_report_t *); @@ -561,7 +561,7 @@ void handle_heartbeat_msg(uart_packet_t *, device_t *); void handle_proxy_msg(uart_packet_t *, device_t *); void handle_api_msgs(uart_packet_t *, device_t *); void handle_api_read_all_msg(uart_packet_t *, device_t *); -void handle_toggle_relative_msg(uart_packet_t *, device_t *); +void handle_toggle_gaming_msg(uart_packet_t *, device_t *); void switch_output(device_t *, uint8_t); diff --git a/src/keyboard.c b/src/keyboard.c index 8f96f04..aea00e6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -56,7 +56,7 @@ hotkey_combo_t hotkeys[] = { .keys = {HID_KEY_G}, .key_count = 1, .acknowledge = true, - .action_handler = &toggle_relative_mode_handler}, + .action_handler = &toggle_gaming_mode_handler}, /* Erase stored config */ {.modifier = KEYBOARD_MODIFIER_RIGHTSHIFT, diff --git a/src/mouse.c b/src/mouse.c index e640b12..79a9198 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -184,8 +184,8 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) { int direction = jump_left ? LEFT : RIGHT; - /* No switching allowed if explicitly disabled */ - if (state->switch_lock) + /* No switching allowed if explicitly disabled or in gaming mode */ + if (state->switch_lock || state->gaming_mode) return; /* No jump condition met == nothing to do, return */ @@ -243,7 +243,7 @@ mouse_report_t create_mouse_report(device_t *state, mouse_values_t *values) { }; /* Workaround for Windows multiple desktops */ - if (state->relative_mouse) { + if (state->relative_mouse || state->gaming_mode) { mouse_report.x = values->move_x; mouse_report.y = values->move_y; mouse_report.mode = RELATIVE; diff --git a/src/uart.c b/src/uart.c index 2b51627..134cb21 100644 --- a/src/uart.c +++ b/src/uart.c @@ -76,7 +76,7 @@ const uart_handler_t uart_handler[] = { {.type = SWITCH_LOCK_MSG, .handler = handle_switch_lock_msg}, {.type = SYNC_BORDERS_MSG, .handler = handle_sync_borders_msg}, {.type = FLASH_LED_MSG, .handler = handle_flash_led_msg}, - {.type = RELATIVE_MODE_MSG, .handler = handle_toggle_relative_msg}, + {.type = GAMING_MODE_MSG, .handler = handle_toggle_gaming_msg}, {.type = CONSUMER_CONTROL_MSG, .handler = handle_consumer_control_msg}, /* Config */