added tec/rec counters

This commit is contained in:
Данила Горнушко 2023-11-28 12:40:10 +03:00
parent 397e9f9b45
commit 09a14f390d
2 changed files with 7 additions and 3 deletions

View file

@ -2,7 +2,6 @@ TODO:
add caninstall and canstart
canup/caninstall parameters (without filtering)
add filtering (software and hardware)
add tec/rec counter
better alarms handling, can recovering
better history
clear history and clear screen commands

View file

@ -29,14 +29,14 @@ static const bool use_colors = true;
#endif
static const char* TAG = "console task";
char prompt_buf[40];
char prompt_buf[60];
esp_console_config_t console_config;
struct linenoiseState ls;
SemaphoreHandle_t console_taken_sem;
static void update_prompt() {
char text[30];
char text[45];
int text_len;
static char* prompt_color;
text[0] = '\0';
@ -66,6 +66,11 @@ static void update_prompt() {
prompt_color = LOG_COLOR(LOG_COLOR_RED);
break;
}
if (curr_can_state.state != CAN_NOT_INSTALLED) {
char tec_rec[25];
snprintf(tec_rec, 24, " [TEC: %" PRIu32 "][REC: %" PRIu32 "]", curr_can_state.tx_error_counter, curr_can_state.rx_error_counter);
strcat(text, tec_rec);
}
strcat(text, " > ");
prompt_buf[0] = '\0';
if (use_colors) {