diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index 565f247..dbe9da5 100644 --- a/firmware/CMakeLists.txt +++ b/firmware/CMakeLists.txt @@ -2,7 +2,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) -set(PROJECT_VER "1.4.0") +set(PROJECT_VER "1.4.1") add_definitions(-DFIRMWARE_VERSION=\"${PROJECT_VER}\") # Add this line to disable the specific warning diff --git a/firmware/main/apps/app_setup/app_setup.cpp b/firmware/main/apps/app_setup/app_setup.cpp index 815c4b6..eb14452 100644 --- a/firmware/main/apps/app_setup/app_setup.cpp +++ b/firmware/main/apps/app_setup/app_setup.cpp @@ -92,6 +92,11 @@ void AppSetup::onOpen() _destroy_menu = true; _worker = std::make_unique(); }}, + {"Microphone", + [&]() { + _destroy_menu = true; + _worker = std::make_unique(); + }}, {"RGB Strip", [&]() { _destroy_menu = true; diff --git a/firmware/main/apps/app_setup/workers/audio.cpp b/firmware/main/apps/app_setup/workers/audio.cpp new file mode 100644 index 0000000..f88159b --- /dev/null +++ b/firmware/main/apps/app_setup/workers/audio.cpp @@ -0,0 +1,212 @@ +/* + * 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