update: 📝 更新main.c添加重启和显示编译时间命令,更新串口打印
This commit is contained in:
parent
604d356a99
commit
f263ea3a34
35
main/main.c
35
main/main.c
@ -46,14 +46,14 @@ void app_main(void)
|
|||||||
esp_chip_info_t chip_info;
|
esp_chip_info_t chip_info;
|
||||||
uint32_t flash_size;
|
uint32_t flash_size;
|
||||||
esp_chip_info(&chip_info);
|
esp_chip_info(&chip_info);
|
||||||
// printf("This is %s chip with %d CPU core(s), %s%s%s%s, ", CONFIG_IDF_TARGET,
|
printf("This is %s chip with %d CPU core(s), %s%s%s%s, ", CONFIG_IDF_TARGET,
|
||||||
// chip_info.cores,
|
chip_info.cores,
|
||||||
// (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
|
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
|
||||||
// (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
|
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
|
||||||
// (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
|
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
|
||||||
// (chip_info.features & CHIP_FEATURE_IEEE802154)
|
(chip_info.features & CHIP_FEATURE_IEEE802154)
|
||||||
// ? ", 802.15.4 (Zigbee/Thread)"
|
? ", 802.15.4 (Zigbee/Thread)"
|
||||||
// : "");
|
: "");
|
||||||
|
|
||||||
unsigned major_rev = chip_info.revision / 100;
|
unsigned major_rev = chip_info.revision / 100;
|
||||||
unsigned minor_rev = chip_info.revision % 100;
|
unsigned minor_rev = chip_info.revision % 100;
|
||||||
@ -75,7 +75,9 @@ void app_main(void)
|
|||||||
// vTaskDelay(1000 / portTICK_PERIOD_MS);
|
// vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
// }
|
// }
|
||||||
cdc_printf("start run app:\r\n");
|
cdc_printf("start run app:\r\n");
|
||||||
|
|
||||||
xTaskCreate(imp_main_app_task, "main", 2048, NULL, 10, NULL);
|
xTaskCreate(imp_main_app_task, "main", 2048, NULL, 10, NULL);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// cdc_printf("start run app:\r\n");
|
// cdc_printf("start run app:\r\n");
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
@ -85,3 +87,20 @@ void app_main(void)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _show_build_time(int argc, char** argv)
|
||||||
|
{
|
||||||
|
cdc_printf("build at %s %s\n", __DATE__, __TIME__);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t imp_restart_esp()
|
||||||
|
{
|
||||||
|
cdc_printf("Restarting now.\n");
|
||||||
|
vTaskDelay(10);
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
||||||
|
reboot, imp_restart_esp, restart esp);
|
||||||
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
|
||||||
|
show_build_time, _show_build_time, show the build time);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user