mirror of
https://github.com/ravinrabbid/DonCon2040.git
synced 2024-11-20 03:37:07 +01:00
Release buttons when entering menu
This commit is contained in:
parent
4244a4ff17
commit
75bcf4dd96
@ -61,6 +61,8 @@ struct InputState {
|
||||
|
||||
usb_report_t getReport(usb_mode_t mode);
|
||||
|
||||
void releaseAll();
|
||||
|
||||
bool checkHotkey();
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -290,6 +290,11 @@ usb_report_t InputState::getDebugReport() {
|
||||
return {(uint8_t *)m_debug_report.c_str(), static_cast<uint16_t>(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;
|
||||
|
Loading…
Reference in New Issue
Block a user