Skip to content

Commit

Permalink
default sensor_buffer_size to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Jun 13, 2024
1 parent f3b9db8 commit 57059b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
7 changes: 5 additions & 2 deletions include/common/core/sensor_buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma once

constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE;
#ifndef SENSOR_BUFF_SIZE
#define SENSOR_BUFFER_SIZE = 0;
#else
constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE;
#endif
12 changes: 3 additions & 9 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MMR920 {
sensor_buffer_index = 0;
}

(*sensor_buffer).at(sensor_buffer_index) = data;
sensor_buffer->at(sensor_buffer_index) = data;
sensor_buffer_index++;
}

Expand Down Expand Up @@ -330,7 +330,6 @@ class MMR920 {
_registers.pressure_result.reading, sensor_version);

if (max_pressure_sync) {
sensor_buffer_log(pressure);
bool this_tick_over_threshold =
std::fabs(pressure - current_pressure_baseline_pa) >=
mmr920::get_max_pressure_reading(sensor_version);
Expand Down Expand Up @@ -368,12 +367,8 @@ class MMR920 {

if (echo_this_time) {
auto response_pressure = pressure - current_pressure_baseline_pa;
#ifdef USE_SENSOR_MOVE
if (sensor_buffer_index < SENSOR_BUFFER_SIZE) {
(*sensor_buffer).at(sensor_buffer_index) = response_pressure;
sensor_buffer_index++;
}
#else
// do we want pressure or response pressure
sensor_buffer_log(pressure);
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::ReadFromSensorResponse{
Expand All @@ -382,7 +377,6 @@ class MMR920 {
.sensor_id = sensor_id,
.sensor_data =
mmr920::reading_to_fixed_point(response_pressure)});
#endif
}
}

Expand Down
2 changes: 2 additions & 0 deletions sensors/tests/test_capacitive_sensor.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define SENSOR_BUFF_SIZE = 500

#include "can/core/ids.hpp"
#include "can/core/messages.hpp"
#include "catch2/catch.hpp"
Expand Down

0 comments on commit 57059b8

Please sign in to comment.