forked from test34/can_wizard
Rename can_messages to uart_tx_ringbuf
This commit is contained in:
parent
382627a9c2
commit
51d6ae7dd6
3 changed files with 6 additions and 6 deletions
|
@ -91,7 +91,7 @@ void console_task_tx(void* arg) {
|
||||||
const int fd = fileno(stdout);
|
const int fd = fileno(stdout);
|
||||||
size_t msg_to_print_size;
|
size_t msg_to_print_size;
|
||||||
while(1) {
|
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();
|
update_prompt();
|
||||||
xSemaphoreTake(console_taken_sem, portMAX_DELAY);
|
xSemaphoreTake(console_taken_sem, portMAX_DELAY);
|
||||||
xSemaphoreTake(stdout_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);
|
write(fd, msg_to_print, msg_to_print_size);
|
||||||
flushWrite();
|
flushWrite();
|
||||||
}
|
}
|
||||||
vRingbufferReturnItem(can_messages, (void *) msg_to_print);
|
vRingbufferReturnItem(uart_tx_ringbuf, (void *) msg_to_print);
|
||||||
}
|
}
|
||||||
linenoiseShow(&ls);
|
linenoiseShow(&ls);
|
||||||
xSemaphoreGive(stdout_taken_sem);
|
xSemaphoreGive(stdout_taken_sem);
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
#include "stdbool.h"
|
#include "stdbool.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
RingbufHandle_t can_messages;
|
RingbufHandle_t uart_tx_ringbuf;
|
||||||
bool timestamp_enabled = false;
|
bool timestamp_enabled = false;
|
||||||
|
|
||||||
void init_tx_ringbuf() {
|
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.
|
// 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) {
|
int vxprintf(const char *fmt, va_list args) {
|
||||||
char msg_to_send[300];
|
char msg_to_send[300];
|
||||||
const size_t str_len = vsnprintf(msg_to_send, 299, fmt, args);
|
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;
|
return str_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
typedef int (*print_func)(const char *fmt, ...);
|
typedef int (*print_func)(const char *fmt, ...);
|
||||||
|
|
||||||
extern RingbufHandle_t can_messages;
|
extern RingbufHandle_t uart_tx_ringbuf;
|
||||||
extern bool timestamp_enabled;
|
extern bool timestamp_enabled;
|
||||||
|
|
||||||
void init_tx_ringbuf();
|
void init_tx_ringbuf();
|
||||||
|
|
Loading…
Reference in a new issue