diff --git a/app/Kconfig b/app/Kconfig index 662c7a52ab1..af3ac57270c 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -352,6 +352,15 @@ config ZMK_EXT_POWER bool "Enable support to control external power output" default y +if ZMK_EXT_POWER + +config ZMK_EXT_POWER_START + bool "Enable external power output by default" + default y + +#ZMK_EXT_POWER +endif + #Power Management endmenu diff --git a/app/boards/arm/glove80/glove80_lh_defconfig b/app/boards/arm/glove80/glove80_lh_defconfig index f5f0d3ea7bb..2e0c384cfca 100644 --- a/app/boards/arm/glove80/glove80_lh_defconfig +++ b/app/boards/arm/glove80/glove80_lh_defconfig @@ -43,6 +43,9 @@ CONFIG_ZMK_RGB_UNDERGLOW=y CONFIG_WS2812_STRIP=y CONFIG_SPI=y +# disable EXT_POWER until underglow gets turned on +CONFIG_ZMK_EXT_POWER_START=n + CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4 diff --git a/app/boards/arm/glove80/glove80_rh_defconfig b/app/boards/arm/glove80/glove80_rh_defconfig index 3e8f5a92bb8..9e7ba1a4a48 100644 --- a/app/boards/arm/glove80/glove80_rh_defconfig +++ b/app/boards/arm/glove80/glove80_rh_defconfig @@ -43,6 +43,9 @@ CONFIG_ZMK_RGB_UNDERGLOW=y CONFIG_WS2812_STRIP=y CONFIG_SPI=y +# disable EXT_POWER until underglow gets turned on +CONFIG_ZMK_EXT_POWER_START=n + CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4 diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index aab09cecbbc..20cf29ada8b 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -152,18 +152,26 @@ static int ext_power_generic_init(const struct device *dev) { k_work_init_delayable(&ext_power_save_work, ext_power_save_state_work); - // Set default value (on) if settings isn't set + // Set default value if settings isn't set settings_load_subtree("ext_power"); if (!data->settings_init) { - data->status = true; + data->status = IS_ENABLED(CONFIG_ZMK_EXT_POWER_START); k_work_schedule(&ext_power_save_work, K_NO_WAIT); - ext_power_enable(dev); + if (data->status) { + ext_power_enable(dev); + } else { + ext_power_disable(dev); + } } #else - // Default to the ext_power being open when no settings - ext_power_enable(dev); + // If no settings, set ext_power on/off + if (IS_ENABLED(CONFIG_ZMK_EXT_POWER_START)) { + ext_power_enable(dev); + } else { + ext_power_disable(dev); + } #endif if (config->init_delay_ms) {