diff --git a/firmware/src/config.cc b/firmware/src/config.cc index f4f0a3b..60e3505 100644 --- a/firmware/src/config.cc +++ b/firmware/src/config.cc @@ -875,7 +875,7 @@ void handle_set_report1(uint8_t report_id, uint8_t const* buffer, uint16_t bufsi case ConfigCommand::RESUME: resume_pending = true; config_updated = true; - // XXX clear input_state, sticky_state, accumulated? + reset_state(); break; case ConfigCommand::PAIR_NEW_DEVICE: pair_new_device(); diff --git a/firmware/src/remapper.cc b/firmware/src/remapper.cc index da8bebd..a818ddb 100644 --- a/firmware/src/remapper.cc +++ b/firmware/src/remapper.cc @@ -1918,6 +1918,13 @@ void print_stats() { processing_time = 0; } +void reset_state() { + memset(registers, 0, sizeof(registers)); + accumulated.clear(); + layer_state_mask = 1; + frame_counter = 0; +} + void set_monitor_enabled(bool enabled) { if (monitor_enabled != enabled) { monitor_input_state.clear(); diff --git a/firmware/src/remapper.h b/firmware/src/remapper.h index f9305f6..f1dcffb 100644 --- a/firmware/src/remapper.h +++ b/firmware/src/remapper.h @@ -37,6 +37,7 @@ void queue_get_feature_report(uint16_t interface, uint8_t report_id, uint8_t len void send_out_report(); bool send_monitor_report(send_report_t do_send_report); void print_stats(); +void reset_state(); void set_monitor_enabled(bool enabled); void monitor_usage(uint32_t usage, int32_t value, uint8_t hub_port);