From 0742790408a433ab501a34e58d4c8bf2f16b65e0 Mon Sep 17 00:00:00 2001 From: david zuhn Date: Sun, 17 Oct 2021 19:08:25 -0500 Subject: [PATCH] console: Console example prints the correct chip model This commit updates the console example's components so that the correct chip model name is printed instead of "Unknown" Closes https://github.com/espressif/esp-idf/pull/7717 [darian@espressif.com: Update chip names, used const char, updated commit message] Signed-off-by: Darian Leung --- .../components/cmd_system/cmd_system.c | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system.c b/examples/system/console/advanced/components/cmd_system/cmd_system.c index 6e82c3df9a..01a849fb92 100644 --- a/examples/system/console/advanced/components/cmd_system/cmd_system.c +++ b/examples/system/console/advanced/components/cmd_system/cmd_system.c @@ -66,11 +66,34 @@ void register_system(void) /* 'version' command */ static int get_version(int argc, char **argv) { + const char *model; esp_chip_info_t info; esp_chip_info(&info); + + switch(info.model) { + case CHIP_ESP32: + model = "ESP32"; + break; + case CHIP_ESP32S2: + model = "ESP32-S2"; + break; + case CHIP_ESP32S3: + model = "ESP32-S3"; + break; + case CHIP_ESP32C3: + model = "ESP32-C3"; + break; + case CHIP_ESP32H2: + model = "ESP32-H2"; + break; + default: + model = "Unknown"; + break; + } + printf("IDF Version:%s\r\n", esp_get_idf_version()); printf("Chip info:\r\n"); - printf("\tmodel:%s\r\n", info.model == CHIP_ESP32 ? "ESP32" : "Unknown"); + printf("\tmodel:%s\r\n", model); printf("\tcores:%d\r\n", info.cores); printf("\tfeature:%s%s%s%s%d%s\r\n", info.features & CHIP_FEATURE_WIFI_BGN ? "/802.11bgn" : "",