/* * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD * * SPDX-License-Identifier: MIT */ #include "workers.h" #include #include using namespace smooth_ui_toolkit::lvgl_cpp; using namespace setup_workers; static std::string _tag = "Setup-Audio"; static constexpr uint32_t _btn_test_color_default_bg = 0xFFDF9A; static constexpr uint32_t _btn_test_color_default_txt = 0x47330A; static constexpr uint32_t _btn_test_color_done_bg = 0xCBEFC9; static constexpr uint32_t _btn_test_color_done_txt = 0x184A20; static constexpr uint32_t _btn_test_color_failed_bg = 0xF4B7B2; static constexpr uint32_t _btn_test_color_failed_txt = 0x6A1D18; static constexpr uint32_t _waveform_point_count = 128; static constexpr uint32_t _waveform_update_interval_ms = 1000 / 24; MicTestWorker::MicTestWorker() { _original_volume = GetHAL().getSpeakerVolume(); GetHAL().setSpeakerVolume(100, false); _waveform_frame.resize(_waveform_point_count, 0); _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); _chart_waveform = std::make_unique(_panel->get()); _chart_waveform->align(LV_ALIGN_CENTER, 0, -68); _chart_waveform->setSize(260, 76); _chart_waveform->setPointCount(_waveform_point_count); _chart_waveform->setStyleSize(0, 0, LV_PART_INDICATOR); _chart_waveform->setRange(LV_CHART_AXIS_PRIMARY_Y, INT16_MIN, INT16_MAX); _chart_waveform->setDivLineCount(2, 6); _chart_waveform->setBorderWidth(0); _chart_waveform->setRadius(12); _chart_waveform->setBgColor(lv_color_hex(0xDDE8FF)); // _chart_waveform->setBgOpa(LV_OPA_100); _waveform_series = _chart_waveform->addSeries(lv_color_hex(0x4A79E8), LV_CHART_AXIS_PRIMARY_Y); update_waveform(); _btn_test = std::make_unique