diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index 74a2ef4..e9a5d8d 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.3.0") +set(PROJECT_VER "1.3.1") add_definitions(-DFIRMWARE_VERSION=\"${PROJECT_VER}\") # Add this line to disable the specific warning diff --git a/firmware/LICENSE b/firmware/LICENSE new file mode 100644 index 0000000..84d8b86 --- /dev/null +++ b/firmware/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 M5Stack Technology CO LTD + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/firmware/main/apps/app_setup/app_setup.cpp b/firmware/main/apps/app_setup/app_setup.cpp index 2b4d98d..815c4b6 100644 --- a/firmware/main/apps/app_setup/app_setup.cpp +++ b/firmware/main/apps/app_setup/app_setup.cpp @@ -72,7 +72,13 @@ void AppSetup::onOpen() }, { "AI.Agent", - {{"Power Saving", + {{"General", + [&]() { + _destroy_menu = true; + _need_warm_reset = true; + _worker = std::make_unique(); + }}, + {"Power Saving", [&]() { _destroy_menu = true; _need_warm_reset = true; diff --git a/firmware/main/apps/app_setup/workers/account.cpp b/firmware/main/apps/app_setup/workers/account.cpp index 87d3dc6..1fa6b17 100644 --- a/firmware/main/apps/app_setup/workers/account.cpp +++ b/firmware/main/apps/app_setup/workers/account.cpp @@ -35,7 +35,9 @@ AccountWorker::PanelInfo::PanelInfo(lv_obj_t* parent, int posY, std::string_view _label_info->setTextColor(lv_color_hex(0x07162C)); _label_info->align(LV_ALIGN_CENTER, 0, 14); _label_info->setWidth(270); + _label_info->setHeight(30); _label_info->setTextAlign(LV_TEXT_ALIGN_CENTER); + _label_info->setLongMode(LV_LABEL_LONG_MODE_SCROLL_CIRCULAR); _label_info->setText(info); } diff --git a/firmware/main/apps/app_setup/workers/ai_agent.cpp b/firmware/main/apps/app_setup/workers/ai_agent.cpp index abd4771..1b0710a 100644 --- a/firmware/main/apps/app_setup/workers/ai_agent.cpp +++ b/firmware/main/apps/app_setup/workers/ai_agent.cpp @@ -6,6 +6,7 @@ #include "workers.h" #include #include +#include #include using namespace smooth_ui_toolkit::lvgl_cpp; @@ -13,6 +14,11 @@ using namespace setup_workers; static std::string _tag = "Setup-AIAgent"; +namespace { +static const std::array _idle_motion_level_labels = {{"Off", "Low", "Medium", "High"}}; + +} // namespace + XiaozhiPowerSavingWorker::XiaozhiPowerSavingWorker() { mclog::info("XiaozhiPowerSavingWorker start"); @@ -139,3 +145,96 @@ void XiaozhiPowerSavingWorker::update_idle_label() auto total_minutes = _config.idleShutdownTimeSeconds / 60; _label_idle_value->setText(fmt::format("{} min", total_minutes)); } + +XiaozhiGeneralWorker::XiaozhiGeneralWorker() +{ + mclog::info("XiaozhiGeneralWorker start"); + + _config = GetHAL().getXiaozhiConfig(); + + for (uint8_t level = 0; level < _idle_motion_level_labels.size(); ++level) { + _idle_motion_levels.push_back(level); + } + + int current_index = static_cast(_idle_motion_levels.size()) - 1; + for (size_t i = 0; i < _idle_motion_levels.size(); ++i) { + if (_idle_motion_levels[i] >= _config.idleRandomMovementLevel) { + 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_general = std::make_unique(_panel->get()); + _panel_general->setSize(296, 156); + _panel_general->align(LV_ALIGN_TOP_MID, 0, 20); + _panel_general->setBgColor(lv_color_hex(0xD2E3FF)); + _panel_general->setBorderWidth(0); + _panel_general->setRadius(18); + _panel_general->setPadding(0, 0, 0, 0); + _panel_general->removeFlag(LV_OBJ_FLAG_SCROLLABLE); + + _label_idle_motion_title = std::make_unique