Set default EXT_POWER status via Kconfig.
Ws previously on by default if no settings.
This commit is contained in:
parent
c2f187fc32
commit
5a395c6025
4 changed files with 28 additions and 5 deletions
|
@ -352,6 +352,15 @@ config ZMK_EXT_POWER
|
||||||
bool "Enable support to control external power output"
|
bool "Enable support to control external power output"
|
||||||
default y
|
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
|
#Power Management
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
CONFIG_WS2812_STRIP=y
|
CONFIG_WS2812_STRIP=y
|
||||||
CONFIG_SPI=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_EXT_POWER=y
|
||||||
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
|
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
|
||||||
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4
|
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4
|
||||||
|
|
|
@ -43,6 +43,9 @@ CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||||
CONFIG_WS2812_STRIP=y
|
CONFIG_WS2812_STRIP=y
|
||||||
CONFIG_SPI=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_EXT_POWER=y
|
||||||
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
|
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=n
|
||||||
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4
|
CONFIG_ZMK_RGB_UNDERGLOW_BRT_STEP=4
|
||||||
|
|
|
@ -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);
|
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");
|
settings_load_subtree("ext_power");
|
||||||
if (!data->settings_init) {
|
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);
|
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
|
#else
|
||||||
// Default to the ext_power being open when no settings
|
// If no settings, set ext_power on/off
|
||||||
ext_power_enable(dev);
|
if (IS_ENABLED(CONFIG_ZMK_EXT_POWER_START)) {
|
||||||
|
ext_power_enable(dev);
|
||||||
|
} else {
|
||||||
|
ext_power_disable(dev);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (config->init_delay_ms) {
|
if (config->init_delay_ms) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue