feat: 添加 console_simple_init 组件支持,提供可交互控制台功能
This commit is contained in:
13
main/main.c
13
main/main.c
@@ -9,6 +9,7 @@
|
||||
#include "lvgl_st7735s_use.h"
|
||||
#include "i2c_master_messager.h"
|
||||
#include "io_device_control.h"
|
||||
#include "console_simple_init.h" // 提供 console_cmd_user_register 和 console_cmd_all_register
|
||||
|
||||
#ifndef CONFIG_I2C_MASTER_MESSAGER_BH1750_ENABLE
|
||||
#define CONFIG_I2C_MASTER_MESSAGER_BH1750_ENABLE 0
|
||||
@@ -41,12 +42,23 @@
|
||||
|
||||
static const char *TAG = "main";
|
||||
|
||||
static int cmd_hello(int argc, char **argv)
|
||||
{
|
||||
printf("hello from BotanicalBuddy\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
// 初始化 Wi-Fi 配网组件,支持长按按键进入配网
|
||||
ESP_ERROR_CHECK(wifi_connect_init());
|
||||
printf("设备启动完成:长按按键进入配网模式,手机连接 ESP32-* 后访问 http://192.168.4.1\n");
|
||||
|
||||
ESP_ERROR_CHECK(console_cmd_init());
|
||||
ESP_ERROR_CHECK(console_cmd_user_register("hello", cmd_hello));
|
||||
ESP_ERROR_CHECK(console_cmd_all_register()); // 可选:自动注册插件命令
|
||||
ESP_ERROR_CHECK(console_cmd_start());
|
||||
|
||||
// 启动 LVGL 演示程序,显示简单的界面
|
||||
ESP_ERROR_CHECK(start_lvgl_demo());
|
||||
|
||||
@@ -120,7 +132,6 @@ void app_main(void)
|
||||
{
|
||||
ESP_ERROR_CHECK(lvgl_st7735s_set_center_text("Sensor waiting..."));
|
||||
}
|
||||
|
||||
}
|
||||
else if (i2c_ready)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user