From 382870387236908ea608fbdfc548e7c1d0b913d3 Mon Sep 17 00:00:00 2001 From: BorisTestov Date: Sat, 6 Jul 2024 21:25:28 +0300 Subject: [PATCH] USB fix --- keyboards/drop/alt/keymaps/fylch_alt/alt_config.h | 2 +- keyboards/drop/alt/keymaps/fylch_alt/config.h | 3 ++- keyboards/drop/alt/keymaps/fylch_alt/keymap.c | 7 +++++++ keyboards/drop/alt/keymaps/fylch_alt/rules.mk | 1 + keyboards/drop/alt/keymaps/fylch_alt/tapdance.h | 1 - 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/keyboards/drop/alt/keymaps/fylch_alt/alt_config.h b/keyboards/drop/alt/keymaps/fylch_alt/alt_config.h index 52333c33ab99..a10bfec153e8 100644 --- a/keyboards/drop/alt/keymaps/fylch_alt/alt_config.h +++ b/keyboards/drop/alt/keymaps/fylch_alt/alt_config.h @@ -4,7 +4,7 @@ typedef union { uint32_t raw; struct { uint8_t current_layer :4; - uint8_t layer_hue[3]; // Hue on each layer + uint8_t layer_hue[3]; }; } alt_config_t; diff --git a/keyboards/drop/alt/keymaps/fylch_alt/config.h b/keyboards/drop/alt/keymaps/fylch_alt/config.h index 77baa106442f..9de94728d61f 100644 --- a/keyboards/drop/alt/keymaps/fylch_alt/config.h +++ b/keyboards/drop/alt/keymaps/fylch_alt/config.h @@ -17,4 +17,5 @@ along with this program. If not, see . #pragma once -#define FORCE_NKRO \ No newline at end of file +#define FORCE_NKRO +#define NO_SUSPEND_POWER_DOWN 1 diff --git a/keyboards/drop/alt/keymaps/fylch_alt/keymap.c b/keyboards/drop/alt/keymaps/fylch_alt/keymap.c index 3dcc702ee5f9..b73331f0b78c 100644 --- a/keyboards/drop/alt/keymaps/fylch_alt/keymap.c +++ b/keyboards/drop/alt/keymaps/fylch_alt/keymap.c @@ -5,6 +5,7 @@ #include "key_processor.h" #include "layers.h" #include "tapdance.h" +#include "usb_device_state.h" #include "utils.h" #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT @@ -19,3 +20,9 @@ void keyboard_post_init_kb(void) { change_layer(0); } + +__attribute__((weak)) void notify_usb_device_state_change_user(enum usb_device_state usb_device_state) { + if (usb_device_state == USB_DEVICE_STATE_SUSPEND && NO_SUSPEND_POWER_DOWN) { + usb_device_state = USB_DEVICE_STATE_CONFIGURED; + } +} diff --git a/keyboards/drop/alt/keymaps/fylch_alt/rules.mk b/keyboards/drop/alt/keymaps/fylch_alt/rules.mk index 3e1fec9a774f..61fff0f2b7a5 100644 --- a/keyboards/drop/alt/keymaps/fylch_alt/rules.mk +++ b/keyboards/drop/alt/keymaps/fylch_alt/rules.mk @@ -1,2 +1,3 @@ TAP_DANCE_ENABLE = yes CONSOLE_ENABLE = no +NO_SUSPEND_POWER_DOWN = yes diff --git a/keyboards/drop/alt/keymaps/fylch_alt/tapdance.h b/keyboards/drop/alt/keymaps/fylch_alt/tapdance.h index d4dce73b81bb..cfd7e2455a16 100644 --- a/keyboards/drop/alt/keymaps/fylch_alt/tapdance.h +++ b/keyboards/drop/alt/keymaps/fylch_alt/tapdance.h @@ -50,7 +50,6 @@ void td_ru_finished(tap_dance_state_t *state, void *user_data) { void td_layer_mod_finished(tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - // We're not saving momentary layers, only persistent layers change_effect_color(alt_config.layer_hue[1]); layer_on(1); } else if (state->count == 2) {