diff --git a/main/can.c b/main/can.c index d792ef8..7a779a4 100644 --- a/main/can.c +++ b/main/can.c @@ -14,7 +14,7 @@ static const char* LOG_TAG = "can"; bool is_error_passive = false; SemaphoreHandle_t can_mutex; -can_status_t curr_can_state = { 0 }; +volatile can_status_t curr_can_state = { 0 }; static can_status_t get_can_state() { can_status_t result; diff --git a/main/can.h b/main/can.h index 225cd1e..9aced92 100644 --- a/main/can.h +++ b/main/can.h @@ -51,7 +51,7 @@ static const twai_general_config_t g_config = { }; extern SemaphoreHandle_t can_mutex; -extern can_status_t curr_can_state; +extern volatile can_status_t curr_can_state; // functions diff --git a/main/cmd_can.c b/main/cmd_can.c index 693e759..efd5997 100644 --- a/main/cmd_can.c +++ b/main/cmd_can.c @@ -1,4 +1,5 @@ #include "cmd_can.h" +#include "esp_log.h" #include "freertos/portmacro.h" #include "inttypes.h" #include "driver/twai.h" @@ -116,6 +117,8 @@ static int canstats(int argc, char **argv) { static int canup(int argc, char **argv) { esp_err_t res; + esp_log_level_t prev_gpio_lvl = esp_log_level_get("gpio"); + esp_log_level_set("gpio", ESP_LOG_ERROR); xSemaphoreTake(can_mutex, portMAX_DELAY); // Install CAN driver // TODO: add CAN filtering @@ -130,6 +133,7 @@ static int canup(int argc, char **argv) { res = twai_start(); printf("CAN driver started\n"); xSemaphoreGive(can_mutex); + esp_log_level_set("gpio", prev_gpio_lvl); return 0; }