From 823cb8d7114766ddbb3552725a57882ddd635b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=93=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D1=83=D1=88=D0=BA=D0=BE?= Date: Fri, 24 Nov 2023 09:31:05 +0300 Subject: [PATCH] fix some bugs --- main/console.c | 6 +++--- main/main.c | 1 - main/xvprintf.c | 1 - sdkconfig | 12 ++++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/main/console.c b/main/console.c index ec9174f..73fc45d 100644 --- a/main/console.c +++ b/main/console.c @@ -12,6 +12,7 @@ #include "linenoise/linenoise.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "freertos/semphr.h" #include "esp_vfs_usb_serial_jtag.h" #include "driver/usb_serial_jtag.h" #include "cmd_system.h" @@ -49,7 +50,6 @@ void console_task_tx(void* arg) { const int fd = fileno(stdout); char *msg_to_print; size_t msg_to_print_size; - vTaskDelay(pdMS_TO_TICKS(200)); while(1) { msg_to_print = (char *)xRingbufferReceive(can_messages, &msg_to_print_size, portMAX_DELAY); if (msg_to_print != NULL) { @@ -68,7 +68,6 @@ void console_task_interactive(void* arg) { stdout_taken_sem = xSemaphoreCreateMutex(); char *buf = calloc(1, console_config.max_cmdline_length); char *line; - vTaskDelay(pdMS_TO_TICKS(15)); //give some time for app_main to finish /* Figure out if the terminal supports escape sequences */ printf("Testing your console..."); int probe_status = linenoiseProbe(); @@ -91,6 +90,8 @@ void console_task_interactive(void* arg) { ls.buf = buf; ls.prompt = prompt; linenoiseEditStart(&ls); + xTaskCreate(console_task_tx, "console tsk tx", 4096, NULL, CONFIG_CONSOLE_TX_PRIORITY, NULL); + esp_log_set_vprintf(&vxprintf); while (true) { line = linenoiseEditFeed(&ls); if (line == linenoiseEditMore) continue; @@ -119,7 +120,6 @@ void console_task_interactive(void* arg) { } /* linenoise allocates line buffer on the heap, so need to free it */ linenoiseFree(line); - get_prompt(prompt); linenoiseEditStart(&ls); } diff --git a/main/main.c b/main/main.c index 99f10f9..ce4c47d 100644 --- a/main/main.c +++ b/main/main.c @@ -13,6 +13,5 @@ void app_main(void) { xTaskCreate(can_task, "can task", 4096, NULL, CONFIG_CAN_TASK_PRIORITY, NULL); initialize_filesystem(); initialize_console(); - xTaskCreate(console_task_tx, "console tsk tx", 4096, NULL, CONFIG_CONSOLE_TX_PRIORITY, NULL); xTaskCreate(console_task_interactive, "console tsk int", 4096, NULL, CONFIG_CONSOLE_INT_PRIORITY, NULL); } diff --git a/main/xvprintf.c b/main/xvprintf.c index cb2e9ea..738c731 100644 --- a/main/xvprintf.c +++ b/main/xvprintf.c @@ -9,7 +9,6 @@ RingbufHandle_t can_messages; void init_tx_ringbuf() { can_messages = xRingbufferCreate(2200, RINGBUF_TYPE_NOSPLIT); - esp_log_set_vprintf(&vxprintf); } // This function will be called by the ESP log library every time ESP_LOG needs to be performed. diff --git a/sdkconfig b/sdkconfig index e0a3edd..e144422 100644 --- a/sdkconfig +++ b/sdkconfig @@ -823,12 +823,12 @@ CONFIG_ESP_CONSOLE_SECONDARY_NONE=y CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y CONFIG_ESP_CONSOLE_UART_NUM=0 CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_TIMEOUT_MS=2000 CONFIG_ESP_TASK_WDT_EN=y CONFIG_ESP_TASK_WDT_INIT=y # CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_TIMEOUT_S=15 +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set # CONFIG_ESP_PANIC_HANDLER_IRAM is not set # CONFIG_ESP_DEBUG_STUBS_ENABLE is not set CONFIG_ESP_DEBUG_OCDAWARE=y @@ -1667,12 +1667,12 @@ CONFIG_MAIN_TASK_STACK_SIZE=7168 # CONFIG_ESP_CONSOLE_UART_NONE is not set CONFIG_CONSOLE_UART_NUM=0 CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 +CONFIG_INT_WDT_TIMEOUT_MS=2000 CONFIG_TASK_WDT=y CONFIG_ESP_TASK_WDT=y # CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_TASK_WDT_TIMEOUT_S=15 +# CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set # CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set CONFIG_ESP32C3_DEBUG_OCDAWARE=y CONFIG_BROWNOUT_DET=y