diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index 2d397bc..74a2ef4 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.2.6") +set(PROJECT_VER "1.3.0") 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 a50a917..2b4d98d 100644 --- a/firmware/main/apps/app_setup/app_setup.cpp +++ b/firmware/main/apps/app_setup/app_setup.cpp @@ -70,6 +70,15 @@ void AppSetup::onOpen() _worker = std::make_unique(); }}}, }, + { + "AI.Agent", + {{"Power Saving", + [&]() { + _destroy_menu = true; + _need_warm_reset = true; + _worker = std::make_unique(); + }}}, + }, { "Hardware Test", {{"Servo", diff --git a/firmware/main/apps/app_setup/workers/account.cpp b/firmware/main/apps/app_setup/workers/account.cpp index fc81885..87d3dc6 100644 --- a/firmware/main/apps/app_setup/workers/account.cpp +++ b/firmware/main/apps/app_setup/workers/account.cpp @@ -120,8 +120,7 @@ void AccountWorker::update() mclog::tagInfo(_tag, "unbind clicked"); _page_account.reset(); - // Unbind account - { + _worker_reset = std::make_unique([]() { auto loading_page = std::make_unique(0xF6F6F6, 0x26206A); GetHAL().lvglUnlock(); @@ -135,10 +134,7 @@ void AccountWorker::update() } GetHAL().lvglLock(); - } - - // Factory reset - _worker_reset = std::make_unique(); + }); } else if (_page_account->isQuitClicked()) { mclog::tagInfo(_tag, "quit clicked"); _is_done = true; diff --git a/firmware/main/apps/app_setup/workers/ai_agent.cpp b/firmware/main/apps/app_setup/workers/ai_agent.cpp new file mode 100644 index 0000000..abd4771 --- /dev/null +++ b/firmware/main/apps/app_setup/workers/ai_agent.cpp @@ -0,0 +1,141 @@ +/* + * SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD + * + * SPDX-License-Identifier: MIT + */ +#include "workers.h" +#include +#include +#include + +using namespace smooth_ui_toolkit::lvgl_cpp; +using namespace setup_workers; + +static std::string _tag = "Setup-AIAgent"; + +XiaozhiPowerSavingWorker::XiaozhiPowerSavingWorker() +{ + mclog::info("XiaozhiPowerSavingWorker start"); + + for (uint32_t seconds = 0; seconds <= 3600; seconds += 300) { + _idle_shutdown_levels.push_back(seconds); + } + + _config = GetHAL().getXiaozhiConfig(); + + int current_index = static_cast(_idle_shutdown_levels.size()) - 1; + for (size_t i = 0; i < _idle_shutdown_levels.size(); ++i) { + if (_idle_shutdown_levels[i] >= _config.idleShutdownTimeSeconds) { + 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->setPadding(0, 50, 24, 18); + _panel->setScrollDir(LV_DIR_VER); + _panel->setScrollbarMode(LV_SCROLLBAR_MODE_ACTIVE); + + _panel_idle_shutdown = std::make_unique(_panel->get()); + _panel_idle_shutdown->setSize(296, 148); + _panel_idle_shutdown->align(LV_ALIGN_TOP_MID, 0, 20); + _panel_idle_shutdown->setBgColor(lv_color_hex(0xD2E3FF)); + _panel_idle_shutdown->setBorderWidth(0); + _panel_idle_shutdown->setRadius(18); + _panel_idle_shutdown->setPadding(0, 0, 0, 0); + _panel_idle_shutdown->removeFlag(LV_OBJ_FLAG_SCROLLABLE); + + _label_idle_title = std::make_unique