diff --git a/app/Kconfig b/app/Kconfig index a45f2dc23f0a..84a2aeb08aa8 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -450,6 +450,15 @@ config ZMK_GPIO_KEY_WAKEUP_TRIGGER default y depends on DT_HAS_ZMK_GPIO_KEY_WAKEUP_TRIGGER_ENABLED && ZMK_PM_SOFT_OFF +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/src/ext_power_generic.c b/app/src/ext_power_generic.c index 2586f4368524..9b179fcbb0a6 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -145,18 +145,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) {