/* * 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; using namespace stackchan; static std::string _tag = "Setup-Connectivity"; WifiSetupWorker::WifiSetupWorker() { _state = State::AppDownload; _last_state = State::None; _is_first_in = true; // Create default avatar auto avatar = std::make_unique(); avatar->init(lv_screen_active(), &lv_font_montserrat_24); avatar->leftEye().setVisible(false); avatar->rightEye().setVisible(false); avatar->mouth().setVisible(false); GetStackChan().attachAvatar(std::move(avatar)); } WifiSetupWorker::~WifiSetupWorker() { GetHAL().onAppConfigEvent.disconnect(_app_config_signal_id); GetStackChan().resetAvatar(); } void WifiSetupWorker::update() { cleanup_ui(); update_state(); } void WifiSetupWorker::update_state() { switch (_state) { case State::AppDownload: { if (_is_first_in) { _is_first_in = false; auto& data = _state_app_download_data; data.panel = std::make_unique(lv_screen_active()); data.panel->setBgColor(lv_color_hex(0xEDF4FF)); data.panel->align(LV_ALIGN_CENTER, 0, 0); data.panel->setBorderWidth(0); data.panel->setSize(320, 240); data.panel->setRadius(0); data.title = std::make_unique