/* * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD * * SPDX-License-Identifier: MIT */ #include "workers.h" #include #include #include #include using namespace smooth_ui_toolkit::lvgl_cpp; using namespace setup_workers; static std::string _tag = "Setup-Display"; static std::vector _brightness_levels = {1, 15, 30, 45, 60, 75, 90, 100}; BrightnessSetupWorker::BrightnessSetupWorker() { mclog::info("BrightnessSetupWorker start"); uint8_t current_brightness = GetHAL().getBackLightBrightness(); int current_index = 0; for (size_t i = 0; i < _brightness_levels.size(); i++) { if (_brightness_levels[i] >= current_brightness) { current_index = i; break; } } _panel = std::make_unique(lv_screen_active()); _panel->setBgColor(lv_color_hex(0xEDF4FF)); _panel->align(LV_ALIGN_CENTER, 0, 0); _panel->setBorderWidth(0); _panel->setSize(320, 240); _panel->setRadius(0); _panel->removeFlag(LV_OBJ_FLAG_SCROLLABLE); _label_brightness = std::make_unique