feat: 移动控制台命令初始化到主循环中,确保在 I2C 准备后注册命令
This commit is contained in:
10
main/main.c
10
main/main.c
@@ -49,11 +49,6 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(wifi_connect_init());
|
ESP_ERROR_CHECK(wifi_connect_init());
|
||||||
printf("设备启动完成:长按按键进入配网模式,手机连接 ESP32-* 后访问 http://192.168.4.1\n");
|
printf("设备启动完成:长按按键进入配网模式,手机连接 ESP32-* 后访问 http://192.168.4.1\n");
|
||||||
|
|
||||||
ESP_ERROR_CHECK(console_cmd_init());
|
|
||||||
ESP_ERROR_CHECK(console_user_cmds_register());
|
|
||||||
ESP_ERROR_CHECK(console_cmd_all_register()); // 可选:自动注册插件命令
|
|
||||||
ESP_ERROR_CHECK(console_cmd_start());
|
|
||||||
|
|
||||||
// 启动 LVGL 演示程序,显示简单的界面
|
// 启动 LVGL 演示程序,显示简单的界面
|
||||||
ESP_ERROR_CHECK(start_lvgl_demo());
|
ESP_ERROR_CHECK(start_lvgl_demo());
|
||||||
|
|
||||||
@@ -91,6 +86,11 @@ void app_main(void)
|
|||||||
i2c_ready = true;
|
i2c_ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(console_cmd_init());
|
||||||
|
ESP_ERROR_CHECK(console_user_cmds_register());
|
||||||
|
ESP_ERROR_CHECK(console_cmd_all_register()); // 可选:自动注册插件命令
|
||||||
|
ESP_ERROR_CHECK(console_cmd_start());
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
i2c_master_messager_data_t sensor_data = {0};
|
i2c_master_messager_data_t sensor_data = {0};
|
||||||
|
|||||||
Reference in New Issue
Block a user