Update launcher for power kernel driver

This commit is contained in:
Ken Van Hoeylandt 2026-07-11 02:15:46 +02:00
parent f9384d3533
commit 24b12d763d

View File

@ -4,13 +4,14 @@
#include <Tactility/app/AppPaths.h> #include <Tactility/app/AppPaths.h>
#include <Tactility/app/AppRegistration.h> #include <Tactility/app/AppRegistration.h>
#include <Tactility/app/setup/Setup.h> #include <Tactility/app/setup/Setup.h>
#include <Tactility/hal/power/PowerDevice.h>
#include <Tactility/service/loader/Loader.h> #include <Tactility/service/loader/Loader.h>
#include <Tactility/settings/BootSettings.h> #include <Tactility/settings/BootSettings.h>
#include <cstring> #include <cstring>
#include <lvgl.h> #include <lvgl.h>
#include <tactility/device.h>
#include <tactility/drivers/power_supply.h>
#include <tactility/log.h> #include <tactility/log.h>
#include <tactility/lvgl_fonts.h> #include <tactility/lvgl_fonts.h>
#include <tactility/lvgl_icon_launcher.h> #include <tactility/lvgl_icon_launcher.h>
@ -73,9 +74,9 @@ class LauncherApp final : public App {
static bool shouldShowPowerButton() { static bool shouldShowPowerButton() {
bool show_power_button = false; bool show_power_button = false;
hal::findDevices<hal::power::PowerDevice>(hal::Device::Type::Power, [&show_power_button](const auto& device) { device_for_each_of_type(&POWER_SUPPLY_TYPE, &show_power_button, [](Device* device, void* context) {
if (device->supportsPowerOff()) { if (device_is_ready(device) && power_supply_supports_power_off(device)) {
show_power_button = true; *static_cast<bool*>(context) = true;
return false; // stop iterating return false; // stop iterating
} else { } else {
return true; // continue iterating return true; // continue iterating