Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jun 21, 2024
1 parent 4b7b24d commit 994d6ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
5 changes: 2 additions & 3 deletions include/sensors/core/tasks/capacitive_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,8 @@ class FDC1004 {
(*sensor_buffer).at(i) = 0;
}
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::Acknowledgment{
.message_index = message_index});
can::ids::NodeId::host,
can::messages::Acknowledgment{.message_index = message_index});
#else
std::ignore = message_index;
#endif
Expand Down
27 changes: 13 additions & 14 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class MMR920 {
echoing = should_echo;
if (should_echo) {
sensor_buffer_index = 0; // reset buffer index
crossed_buffer_index=false;
crossed_buffer_index = false;
sensor_buffer->fill(0.0);
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ class MMR920 {
sensor_buffer_index++;
if (sensor_buffer_index == SENSOR_BUFFER_SIZE) {
sensor_buffer_index = 0;
crossed_buffer_index=true;
crossed_buffer_index = true;
}
}

Expand Down Expand Up @@ -301,14 +301,13 @@ class MMR920 {
}

can_client.send_can_message(
can::ids::NodeId::host,
can::messages::Acknowledgment{
.message_index = count});
can::ids::NodeId::host,
can::messages::Acknowledgment{.message_index = count});
for (int i = 0; i < count; i++) {
// send over buffer and then clear buffer values
// NOLINTNEXTLINE(div-by-zero)
int current_index = (i + start) %
static_cast<int>(SENSOR_BUFFER_SIZE);
int current_index =
(i + start) % static_cast<int>(SENSOR_BUFFER_SIZE);

can_client.send_can_message(
can::ids::NodeId::host,
Expand All @@ -324,9 +323,8 @@ class MMR920 {
}
}
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::Acknowledgment{
.message_index = message_index});
can::ids::NodeId::host,
can::messages::Acknowledgment{.message_index = message_index});
}

auto handle_ongoing_pressure_response(i2c::messages::TransactionResponse &m)
Expand Down Expand Up @@ -397,10 +395,11 @@ class MMR920 {
sensor_buffer_log(response_pressure);

if (sensor_buffer_index == 10 && !crossed_buffer_index) {

current_pressure_baseline_pa =
std::accumulate(sensor_buffer->begin(), sensor_buffer->begin()+10, 0) /
10 + current_pressure_baseline_pa;
std::accumulate(sensor_buffer->begin(),
sensor_buffer->begin() + 10, 0) /
10 +
current_pressure_baseline_pa;
for (auto i = sensor_buffer_index - 10; i < sensor_buffer_index;
i++) {
sensor_buffer->at(sensor_buffer_index) =
Expand Down Expand Up @@ -546,7 +545,7 @@ class MMR920 {
static constexpr uint16_t MAX_PRESSURE_TIME_MS = 200;
#ifdef USE_PRESSURE_MOVE
mmr920::MeasurementRate measurement_mode_rate =
mmr920::MeasurementRate::MEASURE_1;
mmr920::MeasurementRate::MEASURE_2;
#else
mmr920::MeasurementRate measurement_mode_rate =
mmr920::MeasurementRate::MEASURE_4;
Expand Down
1 change: 0 additions & 1 deletion include/sensors/core/tasks/pressure_sensor_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class PressureMessageHandler {

void visit(const can::messages::SendAccumulatedSensorDataRequest &m) {
LOG("Received request to dump pressure data buffer");

driver.send_accumulated_sensor_data(m.message_index);
}

Expand Down

0 comments on commit 994d6ef

Please sign in to comment.