From dfa34d9d162e382cf05442551ee010b0d649eb5e Mon Sep 17 00:00:00 2001 From: RedHawk Date: Sun, 28 May 2023 13:00:56 +0300 Subject: [PATCH] logging: [#54] Removed UART from ISR *No reason to remove definition, since it is still usable. For some reason, powered from my PC it works fine. Yet, it is bad to call UART from ISR anyway, our rotary queue will overflow from time to time, so it's better not to slow down processing. --- source/shoh/src/threads/logging/Log.h | 4 ++++ source/shoh/src/threads/rotary/Rotary.cpp | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/source/shoh/src/threads/logging/Log.h b/source/shoh/src/threads/logging/Log.h index 34c0e0d..3bf6975 100644 --- a/source/shoh/src/threads/logging/Log.h +++ b/source/shoh/src/threads/logging/Log.h @@ -117,6 +117,10 @@ static void create_log_line_nots(const char * _status, #define LOG_DEBUG(fmt, ...) \ create_log_line(global_clock->getTimeFromStart(), C_DEBUG, __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__); +/* + * Even though it doesn't call timer, it still can cause a softlock on the UART transaction. + * Left only for short-term debugging purposes. + */ #define LOG_DEBUG_ISR(fmt, ...) \ create_log_line_nots(C_DEBUG_ISR, __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__); #else diff --git a/source/shoh/src/threads/rotary/Rotary.cpp b/source/shoh/src/threads/rotary/Rotary.cpp index 9c0e382..fcdce48 100644 --- a/source/shoh/src/threads/rotary/Rotary.cpp +++ b/source/shoh/src/threads/rotary/Rotary.cpp @@ -21,10 +21,6 @@ extern "C" portBASE_TYPE xHigherPriorityWoken = pdFALSE; uint8_t data = ThreadCommon::RotaryAction::Right; xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken); - if(!xHigherPriorityWoken) - { - LOG_DEBUG_ISR("[PIN_INT0_IRQn] portEND_SWITCHING_ISR called with False value"); - } portEND_SWITCHING_ISR(xHigherPriorityWoken); } @@ -35,10 +31,6 @@ extern "C" portBASE_TYPE xHigherPriorityWoken = pdFALSE; uint8_t data = ThreadCommon::RotaryAction::Left; xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken); - if(!xHigherPriorityWoken) - { - LOG_DEBUG_ISR("[PIN_INT1_IRQn] portEND_SWITCHING_ISR called with False value"); - } portEND_SWITCHING_ISR(xHigherPriorityWoken); } @@ -49,10 +41,6 @@ extern "C" portBASE_TYPE xHigherPriorityWoken = pdFALSE; uint8_t data = ThreadCommon::RotaryAction::Press; xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken); - if(!xHigherPriorityWoken) - { - LOG_DEBUG_ISR("[PIN_INT2_IRQn] portEND_SWITCHING_ISR called with False value"); - } portEND_SWITCHING_ISR(xHigherPriorityWoken); } }