examples/console: match prompt to the target name

This commit is contained in:
Ivan Grokhotkov
2020-04-03 00:16:54 +02:00
parent ece41b04e3
commit 19f6da99ed

View File

@@ -22,6 +22,7 @@
#include "nvs_flash.h" #include "nvs_flash.h"
static const char* TAG = "example"; static const char* TAG = "example";
#define PROMPT_STR CONFIG_IDF_TARGET
/* Console command history can be stored to and loaded from a file. /* Console command history can be stored to and loaded from a file.
* The easiest way to do this is to use FATFS filesystem on top of * The easiest way to do this is to use FATFS filesystem on top of
@@ -143,7 +144,7 @@ void app_main(void)
/* Prompt to be printed before each line. /* Prompt to be printed before each line.
* This can be customized, made dynamic, etc. * This can be customized, made dynamic, etc.
*/ */
const char* prompt = LOG_COLOR_I "esp32> " LOG_RESET_COLOR; const char* prompt = LOG_COLOR_I PROMPT_STR "> " LOG_RESET_COLOR;
printf("\n" printf("\n"
"This is an example of ESP-IDF console component.\n" "This is an example of ESP-IDF console component.\n"
@@ -163,7 +164,7 @@ void app_main(void)
/* Since the terminal doesn't support escape sequences, /* Since the terminal doesn't support escape sequences,
* don't use color codes in the prompt. * don't use color codes in the prompt.
*/ */
prompt = "esp32> "; prompt = PROMPT_STR "> ";
#endif //CONFIG_LOG_COLORS #endif //CONFIG_LOG_COLORS
} }