pwd 测试成功。
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
idf_component_register(SRCS "main.c"
|
||||
idf_component_register(SRCS "main.cpp"
|
||||
INCLUDE_DIRS ".")
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "cmd_custom.h"
|
||||
#include "CustomCommand.h"
|
||||
#include "LedController.h"
|
||||
#include "cmd_system.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp_console.h"
|
||||
@ -22,7 +23,7 @@ static void initialize_nvs();
|
||||
static void initialize_filesystem();
|
||||
static void initialize_console();
|
||||
|
||||
void app_main() {
|
||||
extern "C" void app_main() {
|
||||
const char *prompt = LOG_COLOR_I PROMPT_STR "> " LOG_RESET_COLOR;
|
||||
initialize_nvs();
|
||||
initialize_filesystem();
|
||||
@ -31,6 +32,8 @@ void app_main() {
|
||||
register_system_common();
|
||||
register_system_sleep();
|
||||
register_custom();
|
||||
|
||||
LedController::instance()->initialize();
|
||||
while (true) {
|
||||
char *line = linenoise(prompt);
|
||||
if (line == NULL) { /* Break on EOF or error */
|
||||
@ -68,24 +71,22 @@ static void initialize_console() {
|
||||
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);
|
||||
|
||||
const uart_config_t uart_config = {
|
||||
.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE,
|
||||
.data_bits = UART_DATA_8_BITS,
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
.source_clk = UART_SCLK_REF_TICK,
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0));
|
||||
ESP_ERROR_CHECK(uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config));
|
||||
uart_config_t uart_config = {0};
|
||||
uart_config.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE;
|
||||
uart_config.data_bits = UART_DATA_8_BITS;
|
||||
uart_config.parity = UART_PARITY_DISABLE;
|
||||
uart_config.stop_bits = UART_STOP_BITS_1;
|
||||
uart_config.source_clk = UART_SCLK_REF_TICK;
|
||||
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);
|
||||
|
||||
esp_console_config_t console_config = {
|
||||
.max_cmdline_args = 8,
|
||||
.max_cmdline_length = 256,
|
||||
.hint_color = atoi(LOG_COLOR_CYAN),
|
||||
};
|
||||
esp_console_config_t console_config = {0};
|
||||
console_config.max_cmdline_args = 8;
|
||||
console_config.max_cmdline_length = 256;
|
||||
console_config.hint_color = atoi(LOG_COLOR_CYAN);
|
||||
|
||||
ESP_ERROR_CHECK(esp_console_init(&console_config));
|
||||
|
||||
linenoiseSetMultiLine(1);
|
||||
@ -111,11 +112,11 @@ static void initialize_nvs() {
|
||||
|
||||
static void initialize_filesystem(void) {
|
||||
static wl_handle_t wl_handle;
|
||||
const esp_vfs_fat_mount_config_t mount_config = {
|
||||
.max_files = 4,
|
||||
.format_if_mount_failed = true,
|
||||
};
|
||||
esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
|
||||
esp_vfs_fat_mount_config_t config;
|
||||
memset(&config, 0, sizeof(esp_vfs_fat_mount_config_t));
|
||||
config.max_files = 4;
|
||||
config.format_if_mount_failed = true;
|
||||
esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &config, &wl_handle);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
|
||||
return;
|
Reference in New Issue
Block a user