Wait forever for next CAN message

- Avoid debug log spam
This commit is contained in:
2026-07-07 14:46:38 +02:00
parent 3780497e8d
commit e57188a51e
+2 -8
View File
@@ -51,23 +51,17 @@ void uart_printf(const char *fmt, ...)
if (len > 0) if (len > 0)
{ {
// 2. OVERFLOW PROTECTION: Cap length to prevent reading stack garbage
if (len >= sizeof(buffer)) len = sizeof(buffer) - 1; if (len >= sizeof(buffer)) len = sizeof(buffer) - 1;
if (osKernelGetState() == osKernelRunning) if (osKernelGetState() == osKernelRunning)
{ {
// 3. RELIABILITY: Wait indefinitely so debug prints aren't silently dropped
if (osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever) == osOK) if (osSemaphoreAcquire(xUARTDMASemaphore, osWaitForever) == osOK)
{ {
HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY); HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
osSemaphoreRelease(xUARTDMASemaphore); osSemaphoreRelease(xUARTDMASemaphore);
} }
} }
else else HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
{
// RTOS hasn't started yet (boot sequence), safe to poll directly
HAL_UART_Transmit(&huart1, (uint8_t*)buffer, len, HAL_MAX_DELAY);
}
} }
} }
/* END uart_printf */ /* END uart_printf */
@@ -183,7 +177,7 @@ void vUARTLogger(void *argument)
for (;;) for (;;)
{ {
if (osMessageQueueGet(xUARTQueue, &message, NULL, 1000U) == osOK) if (osMessageQueueGet(xUARTQueue, &message, NULL, osWaitForever) == osOK)
{ {
if (osSemaphoreAcquire(xUARTDMASemaphore, 100U) == osOK) if (osSemaphoreAcquire(xUARTDMASemaphore, 100U) == osOK)
{ {