/* * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD * * SPDX-License-Identifier: MIT */ #include "workers.h" #include #include #include #include #include #include #include using namespace smooth_ui_toolkit::lvgl_cpp; using namespace setup_workers; static std::string _tag = "Setup-System"; struct TimezoneOption_t { std::string name; std::string tz_posix; }; static const std::vector _timezone_list = { {"Baker Is. (UTC-12)", "BIT12"}, {"Midway Island (UTC-11)", "SST11"}, {"Honolulu (UTC-10)", "HST10"}, {"Alaska (UTC-9)", "AKST9"}, {"Los Angeles (UTC-8)", "PST8"}, {"Denver (UTC-7)", "MST7"}, {"Chicago (UTC-6)", "CST6"}, {"New York (UTC-5)", "EST5"}, {"Halifax (UTC-4)", "AST4"}, {"S.Paulo (UTC-3)", "BRT3"}, {"S.Georgia (UTC-2)", "GST2"}, {"Azores (UTC-1)", "AZOT1"}, {"London (UTC+0)", "GMT0"}, {"Berlin (UTC+1)", "CET-1"}, {"Cairo (UTC+2)", "EET-2"}, {"Moscow (UTC+3)", "MSK-3"}, {"Dubai (UTC+4)", "GST-4"}, {"Karachi (UTC+5)", "PKT-5"}, {"Dhaka (UTC+6)", "BST-6"}, {"Bangkok (UTC+7)", "ICT-7"}, {"Beijing (UTC+8)", "CST-8"}, {"Tokyo (UTC+9)", "JST-9"}, {"Sydney (UTC+10)", "AEST-10"}, {"Noumea (UTC+11)", "SBT-11"}, {"Auckland (UTC+12)", "NZST-12"}, {"Fiji (UTC+13)", "FJT-13"}, {"Line Islands (UTC+14)", "LINT-14"}}; VolumeSetupWorker::VolumeSetupWorker() { mclog::info("VolumeSetupWorker start"); for (int volume = 0; volume <= 100; volume += 5) { _volume_levels.push_back(volume); } uint8_t current_volume = GetHAL().getSpeakerVolume(); int current_index = _volume_levels.size() - 1; for (size_t i = 0; i < _volume_levels.size(); i++) { if (_volume_levels[i] >= current_volume) { current_index = static_cast(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_volume = std::make_unique