diff --git a/.gitignore b/.gitignore index 11b2d321a79..453d9d33e1f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ /build *.DS_Store __pycache__ -.idea \ No newline at end of file +.idea +.vscode \ No newline at end of file diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index e35714da10b..bb194b37041 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -15,6 +15,9 @@ #include #include +#include + +#define ZMK_DISPLAY_NAME CONFIG_LVGL_DISPLAY_DEV_NAME #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) @@ -55,6 +58,16 @@ int ext_power_save_state() { #endif } +static void drivers_update_power_state(bool power) { + LOG_DBG("drivers_update_power_state: %s", power ? "true" : "false"); + static const struct device *display; + display = device_get_binding(ZMK_DISPLAY_NAME); + + if (display != NULL) { + display_update_ext_power(display, power); + } +} + static int ext_power_generic_enable(const struct device *dev) { struct ext_power_generic_data *data = dev->data; const struct ext_power_generic_config *config = dev->config; @@ -64,6 +77,7 @@ static int ext_power_generic_enable(const struct device *dev) { return -EIO; } data->status = true; + drivers_update_power_state(true); return ext_power_save_state(); } @@ -77,6 +91,7 @@ static int ext_power_generic_disable(const struct device *dev) { return -EIO; } data->status = false; + drivers_update_power_state(false); return ext_power_save_state(); }