fix some bugs

This commit is contained in:
Данила Горнушко 2023-11-24 09:31:05 +03:00
parent ba2c37c9c8
commit 823cb8d711
4 changed files with 9 additions and 11 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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.

View file

@ -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