From 694f0ffa68fd06414cfd73beb858871eff4b83eb Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 10 Mar 2024 15:37:37 +0100 Subject: [PATCH] Add config for TRUMA_MSG_QUEUE_LENGTH & TRUMA_LOG_QUEUE_LENGTH --- components/truma_inetbox/LinBusListener.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/truma_inetbox/LinBusListener.h b/components/truma_inetbox/LinBusListener.h index 4bb740f..15cb8d8 100644 --- a/components/truma_inetbox/LinBusListener.h +++ b/components/truma_inetbox/LinBusListener.h @@ -15,6 +15,13 @@ #include #endif // USE_RP2040 +#ifndef TRUMA_MSG_QUEUE_LENGTH +#define TRUMA_MSG_QUEUE_LENGTH 6 +#endif +#ifndef TRUMA_LOG_QUEUE_LENGTH +#define TRUMA_LOG_QUEUE_LENGTH 6 +#endif + namespace esphome { namespace truma_inetbox { @@ -109,18 +116,18 @@ class LinBusListener : public PollingComponent, public uart::UARTDevice { void clear_uart_buffer_(); void setup_framework(); - uint8_t lin_msg_static_queue_storage[6 * sizeof(QUEUE_LIN_MSG)]; + uint8_t lin_msg_static_queue_storage[TRUMA_MSG_QUEUE_LENGTH * sizeof(QUEUE_LIN_MSG)]; StaticQueue_t lin_msg_static_queue_; QueueHandle_t lin_msg_queue_ = - xQueueCreateStatic(/* uxQueueLength */ 6, + xQueueCreateStatic(/* uxQueueLength */ TRUMA_MSG_QUEUE_LENGTH, /* uxItemSize */ sizeof(QUEUE_LIN_MSG), /* pucQueueStorageBuffer */ lin_msg_static_queue_storage, &lin_msg_static_queue_); #if ESPHOME_LOG_LEVEL > ESPHOME_LOG_LEVEL_NONE - uint8_t log_static_queue_storage[6 * sizeof(QUEUE_LOG_MSG)]; + uint8_t log_static_queue_storage[TRUMA_LOG_QUEUE_LENGTH * sizeof(QUEUE_LOG_MSG)]; StaticQueue_t log_static_queue_; QueueHandle_t log_queue_ = - xQueueCreateStatic(/* uxQueueLength */ 6, + xQueueCreateStatic(/* uxQueueLength */ TRUMA_LOG_QUEUE_LENGTH, /* uxItemSize */ sizeof(QUEUE_LOG_MSG), /* pucQueueStorageBuffer */ log_static_queue_storage, &log_static_queue_); #endif