Rename can_messages to uart_tx_ringbuf

This commit is contained in:
okhsunrog 2024-02-12 03:58:10 +03:00
parent 382627a9c2
commit 51d6ae7dd6
3 changed files with 6 additions and 6 deletions

View file

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

View file

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

View file

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