ext_power: add Kconfig for initial ext_power state
Adds a Kconfig setting for the default EXT_POWER status at initialization time. Previously it was always initialized to on if no saved value was present.
This commit is contained in:
parent
954253c6f5
commit
e1fc10651c
2 changed files with 21 additions and 3 deletions
|
|
@ -136,7 +136,11 @@ static int ext_power_settings_commit() {
|
|||
data->status = true;
|
||||
k_work_schedule(&ext_power_save_work, K_NO_WAIT);
|
||||
|
||||
ext_power_enable(dev);
|
||||
if (IS_ENABLED(CONFIG_ZMK_EXT_POWER_START)) {
|
||||
ext_power_enable(dev);
|
||||
} else {
|
||||
ext_power_disable(dev);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -162,8 +166,12 @@ static int ext_power_generic_init(const struct device *dev) {
|
|||
k_work_init_delayable(&ext_power_save_work, ext_power_save_state_work);
|
||||
#endif
|
||||
|
||||
// Enable by default. We may get disabled again once settings load.
|
||||
ext_power_enable(dev);
|
||||
// Set to default state by default. This may change again once settings load.
|
||||
if (IS_ENABLED(CONFIG_ZMK_EXT_POWER_START)) {
|
||||
ext_power_enable(dev);
|
||||
} else {
|
||||
ext_power_disable(dev);
|
||||
}
|
||||
|
||||
if (config->init_delay_ms) {
|
||||
k_msleep(config->init_delay_ms);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue