-
Notifications
You must be signed in to change notification settings - Fork 348
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (49 loc) · 1.58 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* 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>());
#if CONFIG_USE_EZDATA
GetMooncake().installApp(std::make_unique<AppEzdata>());
#endif
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();
}