From 4d684f710ac85c2a7c755d9e795543232ca3b3eb Mon Sep 17 00:00:00 2001 From: caila-marashaj Date: Wed, 12 Jun 2024 14:08:21 -0400 Subject: [PATCH] unconditionally allocate sensor_buff_size --- include/common/core/sensor_buffer.hpp | 6 +----- include/sensors/core/tasks/pressure_driver.hpp | 8 ++------ pipettes/core/CMakeLists.txt | 8 ++++---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/include/common/core/sensor_buffer.hpp b/include/common/core/sensor_buffer.hpp index 287828582..61d792164 100644 --- a/include/common/core/sensor_buffer.hpp +++ b/include/common/core/sensor_buffer.hpp @@ -1,7 +1,3 @@ #pragma once -#ifdef USE_SENSOR_MOVE -constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE; -#else -constexpr size_t SENSOR_BUFFER_SIZE = 0; -#endif \ No newline at end of file +constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE; \ No newline at end of file diff --git a/include/sensors/core/tasks/pressure_driver.hpp b/include/sensors/core/tasks/pressure_driver.hpp index fdc2c3b5c..1bd143ed3 100644 --- a/include/sensors/core/tasks/pressure_driver.hpp +++ b/include/sensors/core/tasks/pressure_driver.hpp @@ -289,10 +289,9 @@ class MMR920 { } void send_accumulated_sensor_data(uint32_t message_index) { -#ifdef USE_SENSOR_MOVE for (int i = 0; i < SENSOR_BUFFER_SIZE; i++) { - // send over buffer adn then clear buffer values - current_index = (i + sensor_buffer_index) % SENSOR_BUFFER_SIZE; + // send over buffer and then clear buffer values + int current_index = (i + sensor_buffer_index) % SENSOR_BUFFER_SIZE; can_client.send_can_message( can::ids::NodeId::host, @@ -308,9 +307,6 @@ class MMR920 { } (*sensor_buffer).at(current_index) = 0; } -#else - std::ignore = message_index; -#endif } auto handle_ongoing_pressure_response(i2c::messages::TransactionResponse &m) diff --git a/pipettes/core/CMakeLists.txt b/pipettes/core/CMakeLists.txt index 105c07d9d..a1860f3d9 100644 --- a/pipettes/core/CMakeLists.txt +++ b/pipettes/core/CMakeLists.txt @@ -17,8 +17,8 @@ endfunction() function(target_pipettes_core_single TARGET REVISION) target_pipettes_core_common(${TARGET} ${REVISION}) target_compile_definitions(${TARGET} PUBLIC PIPETTE_TYPE_DEFINE=SINGLE_CHANNEL) - if(${USE_SENSOR_MOVE}) target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=500) + if(${USE_SENSOR_MOVE}) endif() target_sources(${TARGET} PUBLIC ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/can_task_low_throughput.cpp) @@ -27,8 +27,8 @@ endfunction() function(target_pipettes_core_multi TARGET REVISION) target_pipettes_core_common(${TARGET} ${REVISION}) target_compile_definitions(${TARGET} PUBLIC PIPETTE_TYPE_DEFINE=EIGHT_CHANNEL) - if(${USE_SENSOR_MOVE}) target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=500) + if(${USE_SENSOR_MOVE}) target_compile_definitions(${TARGET} PUBLIC USE_TWO_BUFFERS=true) endif() target_sources(${TARGET} PUBLIC @@ -38,8 +38,8 @@ endfunction() function(target_pipettes_core_96 TARGET REVISION) target_pipettes_core_common(${TARGET} ${REVISION}) target_compile_definitions(${TARGET} PUBLIC PIPETTE_TYPE_DEFINE=NINETY_SIX_CHANNEL) + target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=500) if(${USE_SENSOR_MOVE}) - target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=800) target_compile_definitions(${TARGET} PUBLIC USE_TWO_BUFFERS=true) endif() target_sources(${TARGET} PUBLIC @@ -49,8 +49,8 @@ endfunction() function(target_pipettes_core_384 TARGET REVISION) target_pipettes_core_common(${TARGET} ${REVISION}) target_compile_definitions(${TARGET} PUBLIC PIPETTE_TYPE_DEFINE=THREE_EIGHTY_FOUR_CHANNEL) + target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=500) if(${USE_SENSOR_MOVE}) - target_compile_definitions(${TARGET} PUBLIC SENSOR_BUFF_SIZE=1500) target_compile_definitions(${TARGET} PUBLIC USE_TWO_BUFFERS=true) endif() target_sources(${TARGET} PUBLIC