From f263ea3a341031c008f7ce7d8fdbbc4b84339530 Mon Sep 17 00:00:00 2001 From: impressionyang Date: Tue, 26 Nov 2024 02:25:41 +0000 Subject: [PATCH] =?UTF-8?q?update:=20=F0=9F=93=9D=20=E6=9B=B4=E6=96=B0main?= =?UTF-8?q?.c=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=90=AF=E5=92=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=BC=96=E8=AF=91=E6=97=B6=E9=97=B4=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E4=B8=B2=E5=8F=A3=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/main/main.c b/main/main.c index f6a9eb9..b770382 100755 --- a/main/main.c +++ b/main/main.c @@ -46,14 +46,14 @@ void app_main(void) esp_chip_info_t chip_info; uint32_t flash_size; esp_chip_info(&chip_info); - // printf("This is %s chip with %d CPU core(s), %s%s%s%s, ", CONFIG_IDF_TARGET, - // chip_info.cores, - // (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "", - // (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "", - // (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "", - // (chip_info.features & CHIP_FEATURE_IEEE802154) - // ? ", 802.15.4 (Zigbee/Thread)" - // : ""); + printf("This is %s chip with %d CPU core(s), %s%s%s%s, ", CONFIG_IDF_TARGET, + chip_info.cores, + (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "", + (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "", + (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "", + (chip_info.features & CHIP_FEATURE_IEEE802154) + ? ", 802.15.4 (Zigbee/Thread)" + : ""); unsigned major_rev = chip_info.revision / 100; unsigned minor_rev = chip_info.revision % 100; @@ -72,11 +72,13 @@ void app_main(void) // for (int i = 10; i >= 0; i--) { // printf("Restarting in %d seconds...\n", i); - // vTaskDelay(1000 / portTICK_PERIOD_MS); + // vTaskDelay(1000 / portTICK_PERIOD_MS); // } cdc_printf("start run app:\r\n"); + xTaskCreate(imp_main_app_task, "main", 2048, NULL, 10, NULL); - while(1) { + + while (1) { // cdc_printf("start run app:\r\n"); vTaskDelay(1000 / portTICK_PERIOD_MS); } @@ -85,3 +87,20 @@ void app_main(void) fflush(stdout); 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);