From 51d6ae7dd692ce3f03c70045da2d6414e5293749 Mon Sep 17 00:00:00 2001 From: okhsunrog Date: Mon, 12 Feb 2024 03:58:10 +0300 Subject: [PATCH] Rename can_messages to uart_tx_ringbuf --- main/console.c | 4 ++-- main/xvprintf.c | 6 +++--- main/xvprintf.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main/console.c b/main/console.c index 6ee8f68..d7dfaee 100644 --- a/main/console.c +++ b/main/console.c @@ -91,7 +91,7 @@ void console_task_tx(void* arg) { const int fd = fileno(stdout); size_t msg_to_print_size; while(1) { - char* msg_to_print = xRingbufferReceive(can_messages, &msg_to_print_size, prompt_timeout); + char* msg_to_print = xRingbufferReceive(uart_tx_ringbuf, &msg_to_print_size, prompt_timeout); update_prompt(); xSemaphoreTake(console_taken_sem, portMAX_DELAY); xSemaphoreTake(stdout_taken_sem, portMAX_DELAY); @@ -102,7 +102,7 @@ void console_task_tx(void* arg) { write(fd, msg_to_print, msg_to_print_size); flushWrite(); } - vRingbufferReturnItem(can_messages, (void *) msg_to_print); + vRingbufferReturnItem(uart_tx_ringbuf, (void *) msg_to_print); } linenoiseShow(&ls); xSemaphoreGive(stdout_taken_sem); diff --git a/main/xvprintf.c b/main/xvprintf.c index 653f9d4..1b65853 100644 --- a/main/xvprintf.c +++ b/main/xvprintf.c @@ -4,11 +4,11 @@ #include "stdbool.h" #include "esp_log.h" -RingbufHandle_t can_messages; +RingbufHandle_t uart_tx_ringbuf; bool timestamp_enabled = false; void init_tx_ringbuf() { - can_messages = xRingbufferCreate(2200, RINGBUF_TYPE_NOSPLIT); + uart_tx_ringbuf = xRingbufferCreate(2200, RINGBUF_TYPE_NOSPLIT); } // This function will be called by the ESP log library every time ESP_LOG needs to be performed. @@ -16,7 +16,7 @@ void init_tx_ringbuf() { int vxprintf(const char *fmt, va_list args) { char msg_to_send[300]; const size_t str_len = vsnprintf(msg_to_send, 299, fmt, args); - xRingbufferSend(can_messages, msg_to_send, str_len + 1, pdMS_TO_TICKS(200)); + xRingbufferSend(uart_tx_ringbuf, msg_to_send, str_len + 1, pdMS_TO_TICKS(200)); return str_len; } diff --git a/main/xvprintf.h b/main/xvprintf.h index d046896..cb52f73 100644 --- a/main/xvprintf.h +++ b/main/xvprintf.h @@ -5,7 +5,7 @@ typedef int (*print_func)(const char *fmt, ...); -extern RingbufHandle_t can_messages; +extern RingbufHandle_t uart_tx_ringbuf; extern bool timestamp_enabled; void init_tx_ringbuf();