From 42420bbd6b20e15fdc70181639ea31560b50ec09 Mon Sep 17 00:00:00 2001
From: amass <168062547@qq.com>
Date: Mon, 7 Apr 2025 22:43:28 +0800
Subject: [PATCH] update.

---
 .vscode/c_cpp_properties.json |  2 +-
 .vscode/settings.json         | 11 +++++++----
 main/main.cpp                 |  9 +++++----
 sdkconfig.defaults            |  1 +
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index ee1cac1..05395b9 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -2,7 +2,7 @@
     "configurations": [
         {
             "name": "ESP-IDF",
-            "compilerPath": "${config:idf.toolsPathWin}\\tools\\xtensa-esp-elf\\esp-13.2.0_20230928\\xtensa-esp-elf\\bin\\xtensa-esp32-elf-gcc.exe",
+            "compilerPath": "${config:idf.toolsPathWin}\\tools\\xtensa-esp-elf\\esp-14.2.0_20241119\\xtensa-esp-elf\\bin\\xtensa-esp32-elf-gcc.exe",
             "compileCommands": "${workspaceFolder}/build/compile_commands.json",
             "includePath": [
                 "${config:idf.espIdfPath}/components/**",
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 6641802..73c83c8 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -5,14 +5,17 @@
     "idf.customExtraVars": {
         "OPENOCD_SCRIPTS": "E:\\Projects\\esp\\.espressif\\tools\\openocd-esp32\\v0.12.0-esp32-20230921/openocd-esp32/share/openocd/scripts",
         "IDF_CCACHE_ENABLE": "1",
-        "ESP_ROM_ELF_DIR": "E:\\Projects\\esp\\.espressif\\tools\\esp-rom-elfs\\20230320/"
+        "ESP_ROM_ELF_DIR": "E:\\Projects\\esp\\.espressif\\tools\\esp-rom-elfs\\20230320/",
+        "IDF_TARGET": "esp32"
     },
-    "idf.espIdfPathWin": "E:\\Projects\\esp\\v5.2.1\\esp-idf",
+    "idf.espIdfPathWin": "e:\\Projects\\esp\\v5.4.1\\esp-idf",
     "idf.openOcdConfigs": [
         "interface/ftdi/esp32_devkitj_v1.cfg",
         "target/esp32.cfg"
     ],
-    "idf.portWin": "COM1",
+    "idf.portWin": "COM5",
     "idf.pythonBinPathWin": "E:\\Projects\\esp\\.espressif\\python_env\\idf5.2_py3.11_env\\Scripts\\python.exe",
-    "idf.toolsPathWin": "E:\\Projects\\esp\\.espressif"
+    "idf.toolsPathWin": "e:\\Projects\\.espressif",
+    "idf.pythonInstallPath": "e:\\Projects\\.espressif\\tools\\idf-python\\3.11.2\\python.exe",
+    "idf.flashType": "UART"
 }
diff --git a/main/main.cpp b/main/main.cpp
index 83c4e9d..a877277 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -8,12 +8,13 @@
 #include "esp_console.h"
 #include "esp_log.h"
 #include "esp_system.h"
-#include "esp_vfs_dev.h"
 #include "esp_vfs_fat.h"
 #include "linenoise/linenoise.h"
 #include "nvs.h"
 #include "nvs_flash.h"
+#include <driver/uart_vfs.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #define PROMPT_STR CONFIG_IDF_TARGET
 
@@ -103,8 +104,8 @@ static void initialize_console() {
 
     setvbuf(stdin, NULL, _IONBF, 0);
 
-    esp_vfs_dev_uart_port_set_rx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CR);
-    esp_vfs_dev_uart_port_set_tx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CRLF);
+    uart_vfs_dev_port_set_rx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CR);
+    uart_vfs_dev_port_set_tx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, ESP_LINE_ENDINGS_CRLF);
 
     uart_config_t uart_config = {};
     uart_config.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE;
@@ -115,7 +116,7 @@ static void initialize_console() {
     ESP_ERROR_CHECK(uart_driver_install(static_cast<uart_port_t>(CONFIG_ESP_CONSOLE_UART_NUM), 256, 0, 0, NULL, 0));
     ESP_ERROR_CHECK(uart_param_config(static_cast<uart_port_t>(CONFIG_ESP_CONSOLE_UART_NUM), &uart_config));
 
-    esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
+    uart_vfs_dev_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
 
     esp_console_config_t console_config = {};
     console_config.max_cmdline_args = 8;
diff --git a/sdkconfig.defaults b/sdkconfig.defaults
index b2d26d6..c216d8e 100644
--- a/sdkconfig.defaults
+++ b/sdkconfig.defaults
@@ -18,3 +18,4 @@ CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
 
 # On chips with USB serial, disable secondary console which does not make sense when using console component
 CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
+CONFIG_LOG_COLORS=y