diff --git a/include/utils/InputState.h b/include/utils/InputState.h index 73671fd..fe88e90 100644 --- a/include/utils/InputState.h +++ b/include/utils/InputState.h @@ -61,6 +61,8 @@ struct InputState { usb_report_t getReport(usb_mode_t mode); + void releaseAll(); + bool checkHotkey(); }; diff --git a/src/main.cpp b/src/main.cpp index 5816986..7e48c9c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -157,6 +157,9 @@ int main() { } else if (input_state.checkHotkey()) { menu.activate(); + input_state.releaseAll(); + usb_driver_send_and_receive_report(input_state.getReport(mode)); + ControlMessage ctrl_message{ControlCommand::EnterMenu, {}}; queue_add_blocking(&control_queue, &ctrl_message); } else { diff --git a/src/utils/InputState.cpp b/src/utils/InputState.cpp index 280ccf9..0c65f7a 100644 --- a/src/utils/InputState.cpp +++ b/src/utils/InputState.cpp @@ -290,6 +290,11 @@ usb_report_t InputState::getDebugReport() { return {(uint8_t *)m_debug_report.c_str(), static_cast(m_debug_report.size() + 1)}; } +void InputState::releaseAll() { + drum = {{false, 0}, {false, 0}, {false, 0}, {false, 0}}; + controller = {{false, false, false, false}, {false, false, false, false, false, false, false, false, false, false}}; +} + bool InputState::checkHotkey() { static uint32_t hold_since = 0; static bool hold_active = false;