Skip to content

Commit

Permalink
unconditionally allocate sensor_buff_size
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Jun 12, 2024
1 parent a7e431d commit 4d684f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
6 changes: 1 addition & 5 deletions include/common/core/sensor_buffer.hpp
Original file line number Diff line number Diff line change
@@ -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
constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE;
8 changes: 2 additions & 6 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pipettes/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4d684f7

Please sign in to comment.