forked from test34/can_wizard
fix some bugs
This commit is contained in:
parent
ba2c37c9c8
commit
823cb8d711
4 changed files with 9 additions and 11 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "linenoise/linenoise.h"
|
#include "linenoise/linenoise.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
#include "freertos/semphr.h"
|
||||||
#include "esp_vfs_usb_serial_jtag.h"
|
#include "esp_vfs_usb_serial_jtag.h"
|
||||||
#include "driver/usb_serial_jtag.h"
|
#include "driver/usb_serial_jtag.h"
|
||||||
#include "cmd_system.h"
|
#include "cmd_system.h"
|
||||||
|
@ -49,7 +50,6 @@ void console_task_tx(void* arg) {
|
||||||
const int fd = fileno(stdout);
|
const int fd = fileno(stdout);
|
||||||
char *msg_to_print;
|
char *msg_to_print;
|
||||||
size_t msg_to_print_size;
|
size_t msg_to_print_size;
|
||||||
vTaskDelay(pdMS_TO_TICKS(200));
|
|
||||||
while(1) {
|
while(1) {
|
||||||
msg_to_print = (char *)xRingbufferReceive(can_messages, &msg_to_print_size, portMAX_DELAY);
|
msg_to_print = (char *)xRingbufferReceive(can_messages, &msg_to_print_size, portMAX_DELAY);
|
||||||
if (msg_to_print != NULL) {
|
if (msg_to_print != NULL) {
|
||||||
|
@ -68,7 +68,6 @@ void console_task_interactive(void* arg) {
|
||||||
stdout_taken_sem = xSemaphoreCreateMutex();
|
stdout_taken_sem = xSemaphoreCreateMutex();
|
||||||
char *buf = calloc(1, console_config.max_cmdline_length);
|
char *buf = calloc(1, console_config.max_cmdline_length);
|
||||||
char *line;
|
char *line;
|
||||||
vTaskDelay(pdMS_TO_TICKS(15)); //give some time for app_main to finish
|
|
||||||
/* Figure out if the terminal supports escape sequences */
|
/* Figure out if the terminal supports escape sequences */
|
||||||
printf("Testing your console...");
|
printf("Testing your console...");
|
||||||
int probe_status = linenoiseProbe();
|
int probe_status = linenoiseProbe();
|
||||||
|
@ -91,6 +90,8 @@ void console_task_interactive(void* arg) {
|
||||||
ls.buf = buf;
|
ls.buf = buf;
|
||||||
ls.prompt = prompt;
|
ls.prompt = prompt;
|
||||||
linenoiseEditStart(&ls);
|
linenoiseEditStart(&ls);
|
||||||
|
xTaskCreate(console_task_tx, "console tsk tx", 4096, NULL, CONFIG_CONSOLE_TX_PRIORITY, NULL);
|
||||||
|
esp_log_set_vprintf(&vxprintf);
|
||||||
while (true) {
|
while (true) {
|
||||||
line = linenoiseEditFeed(&ls);
|
line = linenoiseEditFeed(&ls);
|
||||||
if (line == linenoiseEditMore) continue;
|
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 */
|
/* linenoise allocates line buffer on the heap, so need to free it */
|
||||||
linenoiseFree(line);
|
linenoiseFree(line);
|
||||||
get_prompt(prompt);
|
|
||||||
linenoiseEditStart(&ls);
|
linenoiseEditStart(&ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,5 @@ void app_main(void) {
|
||||||
xTaskCreate(can_task, "can task", 4096, NULL, CONFIG_CAN_TASK_PRIORITY, NULL);
|
xTaskCreate(can_task, "can task", 4096, NULL, CONFIG_CAN_TASK_PRIORITY, NULL);
|
||||||
initialize_filesystem();
|
initialize_filesystem();
|
||||||
initialize_console();
|
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);
|
xTaskCreate(console_task_interactive, "console tsk int", 4096, NULL, CONFIG_CONSOLE_INT_PRIORITY, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ RingbufHandle_t can_messages;
|
||||||
|
|
||||||
void init_tx_ringbuf() {
|
void init_tx_ringbuf() {
|
||||||
can_messages = xRingbufferCreate(2200, RINGBUF_TYPE_NOSPLIT);
|
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.
|
// This function will be called by the ESP log library every time ESP_LOG needs to be performed.
|
||||||
|
|
12
sdkconfig
12
sdkconfig
|
@ -823,12 +823,12 @@ CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
|
||||||
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
|
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
|
||||||
CONFIG_ESP_CONSOLE_UART_NUM=0
|
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||||
CONFIG_ESP_INT_WDT=y
|
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_EN=y
|
||||||
CONFIG_ESP_TASK_WDT_INIT=y
|
CONFIG_ESP_TASK_WDT_INIT=y
|
||||||
# CONFIG_ESP_TASK_WDT_PANIC is not set
|
# CONFIG_ESP_TASK_WDT_PANIC is not set
|
||||||
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=15
|
||||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set
|
||||||
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
# CONFIG_ESP_PANIC_HANDLER_IRAM is not set
|
||||||
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
|
||||||
CONFIG_ESP_DEBUG_OCDAWARE=y
|
CONFIG_ESP_DEBUG_OCDAWARE=y
|
||||||
|
@ -1667,12 +1667,12 @@ CONFIG_MAIN_TASK_STACK_SIZE=7168
|
||||||
# CONFIG_ESP_CONSOLE_UART_NONE is not set
|
# CONFIG_ESP_CONSOLE_UART_NONE is not set
|
||||||
CONFIG_CONSOLE_UART_NUM=0
|
CONFIG_CONSOLE_UART_NUM=0
|
||||||
CONFIG_INT_WDT=y
|
CONFIG_INT_WDT=y
|
||||||
CONFIG_INT_WDT_TIMEOUT_MS=300
|
CONFIG_INT_WDT_TIMEOUT_MS=2000
|
||||||
CONFIG_TASK_WDT=y
|
CONFIG_TASK_WDT=y
|
||||||
CONFIG_ESP_TASK_WDT=y
|
CONFIG_ESP_TASK_WDT=y
|
||||||
# CONFIG_TASK_WDT_PANIC is not set
|
# CONFIG_TASK_WDT_PANIC is not set
|
||||||
CONFIG_TASK_WDT_TIMEOUT_S=5
|
CONFIG_TASK_WDT_TIMEOUT_S=15
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
# CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set
|
||||||
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
||||||
CONFIG_ESP32C3_DEBUG_OCDAWARE=y
|
CONFIG_ESP32C3_DEBUG_OCDAWARE=y
|
||||||
CONFIG_BROWNOUT_DET=y
|
CONFIG_BROWNOUT_DET=y
|
||||||
|
|
Loading…
Reference in a new issue