mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-27 11:02:40 +00:00
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
/*
|
|
* SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
#include <smooth_ui_toolkit.hpp>
|
|
#include <uitk/short_namespace.hpp>
|
|
#include <mooncake_log.h>
|
|
#include <mooncake.h>
|
|
#include <apps/apps.h>
|
|
#include <hal/hal.h>
|
|
|
|
using namespace mooncake;
|
|
using namespace smooth_ui_toolkit;
|
|
|
|
extern "C" void app_main(void)
|
|
{
|
|
// Setup logger
|
|
mclog::set_level(mclog::level_info);
|
|
mclog::set_time_format(mclog::time_format_unix_milliseconds);
|
|
|
|
// HAL init
|
|
GetHAL().init();
|
|
|
|
// Setup ui hal
|
|
ui_hal::on_delay([](uint32_t ms) { GetHAL().delay(ms); });
|
|
ui_hal::on_get_tick([]() { return GetHAL().millis(); });
|
|
|
|
// Install apps
|
|
GetMooncake().installApp(std::make_unique<AppLauncher>());
|
|
GetMooncake().installApp(std::make_unique<AppAiAgent>());
|
|
GetMooncake().installApp(std::make_unique<AppAvatar>());
|
|
GetMooncake().installApp(std::make_unique<AppEspnowControl>());
|
|
GetMooncake().installApp(std::make_unique<AppAppCenter>());
|
|
GetMooncake().installApp(std::make_unique<AppEzdata>());
|
|
GetMooncake().installApp(std::make_unique<AppDance>());
|
|
GetMooncake().installApp(std::make_unique<AppSetup>());
|
|
|
|
// Main loop
|
|
while (1) {
|
|
GetHAL().feedTheDog();
|
|
GetHAL().updateHeapStatusLog();
|
|
|
|
GetMooncake().update();
|
|
|
|
if (GetHAL().isXiaozhiStartRequested()) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Uninstall all apps and destroy mooncake
|
|
GetMooncake().uninstallAllApps();
|
|
DestroyMooncake();
|
|
|
|
// Start xiaozhi, never returns
|
|
GetHAL().startXiaozhi();
|
|
}
|