From a7e431dab4876f0990e4acbcb62a7023ddcd07f2 Mon Sep 17 00:00:00 2001 From: caila-marashaj Date: Wed, 12 Jun 2024 13:32:02 -0400 Subject: [PATCH] format + fix typo --- include/sensors/core/tasks/capacitive_driver.hpp | 4 ++-- .../sensors/core/tasks/capacitive_sensor_task.hpp | 4 ++-- include/sensors/core/tasks/pressure_driver.hpp | 6 +++--- sensors/tests/test_capacitive_sensor.cpp | 14 +++++++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/sensors/core/tasks/capacitive_driver.hpp b/include/sensors/core/tasks/capacitive_driver.hpp index a9cdfeae6..7e890a16b 100644 --- a/include/sensors/core/tasks/capacitive_driver.hpp +++ b/include/sensors/core/tasks/capacitive_driver.hpp @@ -223,8 +223,8 @@ class FDC1004 { .message_index = message_index, .sensor = can::ids::SensorType::capacitive, .sensor_id = sensor_id, - .sensor_data = - convert_to_fixed_point((*sensor_buffer).at(i), S15Q16_RADIX)}); + .sensor_data = convert_to_fixed_point( + (*sensor_buffer).at(i), S15Q16_RADIX)}); if (i % 10 == 0) { // slow it down so the can buffer doesn't choke vTaskDelay(50); diff --git a/include/sensors/core/tasks/capacitive_sensor_task.hpp b/include/sensors/core/tasks/capacitive_sensor_task.hpp index abd7bc354..824ba72bb 100644 --- a/include/sensors/core/tasks/capacitive_sensor_task.hpp +++ b/include/sensors/core/tasks/capacitive_sensor_task.hpp @@ -24,7 +24,7 @@ class CapacitiveMessageHandler { sensors::hardware::SensorHardwareBase &hardware, CanClient &can_client, OwnQueue &own_queue, bool shared_task, std::array *sensor_buffer) - : driver{i2c_writer, i2c_poller, can_client, own_queue, + : driver{i2c_writer, i2c_poller, can_client, own_queue, hardware, shared_task, sensor_buffer} {} CapacitiveMessageHandler(const CapacitiveMessageHandler &) = delete; CapacitiveMessageHandler(const CapacitiveMessageHandler &&) = delete; @@ -219,7 +219,7 @@ class CapacitiveSensorTask { // multiple channels. We will thus rely on the sensor id in this case // to determine which CIN configuration the sensor should be in. auto handler = CapacitiveMessageHandler{ - *writer, *poller, *hardware, *can_client, + *writer, *poller, *hardware, *can_client, get_queue(), shared_task, sensor_buffer}; handler.initialize(); utils::TaskMessage message{}; diff --git a/include/sensors/core/tasks/pressure_driver.hpp b/include/sensors/core/tasks/pressure_driver.hpp index 6bd49a31b..fdc2c3b5c 100644 --- a/include/sensors/core/tasks/pressure_driver.hpp +++ b/include/sensors/core/tasks/pressure_driver.hpp @@ -233,7 +233,7 @@ class MMR920 { sensor_buffer_index = 0; } - (*sensor_buffer).at(sensor_buffer_index) = response_pressure; + (*sensor_buffer).at(sensor_buffer_index) = data; sensor_buffer_index++; } @@ -300,8 +300,8 @@ class MMR920 { .message_index = message_index, .sensor = can::ids::SensorType::pressure, .sensor_id = sensor_id, - .sensor_data = - mmr920::reading_to_fixed_point((*sensor_buffer).at(current_index))}); + .sensor_data = mmr920::reading_to_fixed_point( + (*sensor_buffer).at(current_index))}); if (i % 10 == 0) { // slow it down so the can buffer doesn't choke vTaskDelay(50); diff --git a/sensors/tests/test_capacitive_sensor.cpp b/sensors/tests/test_capacitive_sensor.cpp index 0945c6cfc..1d3e5c950 100644 --- a/sensors/tests/test_capacitive_sensor.cpp +++ b/sensors/tests/test_capacitive_sensor.cpp @@ -55,7 +55,8 @@ SCENARIO("read capacitance sensor values without shared CINs") { poller.set_queue(&poller_queue); auto sensor_not_shared = sensors::tasks::CapacitiveMessageHandler{ - writer, poller, mock_hw, queue_client, response_queue, false, &sensor_buffer}; + writer, poller, mock_hw, queue_client, + response_queue, false, &sensor_buffer}; constexpr uint8_t capacitive_id = 0x1; GIVEN("a initialize sensor request") { @@ -383,7 +384,8 @@ SCENARIO("read capacitance sensor values supporting shared CINs") { poller.set_queue(&poller_queue); auto sensor_shared = sensors::tasks::CapacitiveMessageHandler{ - writer, poller, mock_hw, queue_client, response_queue, true, &sensor_buffer}; + writer, poller, mock_hw, queue_client, + response_queue, true, &sensor_buffer}; constexpr uint8_t capacitive_id = 0x1; GIVEN("a initialize sensor request") { @@ -580,8 +582,9 @@ SCENARIO("capacitance driver tests no shared CINs") { queue_client.set_queue(&can_queue); writer.set_queue(&i2c_queue); - sensors::tasks::FDC1004 callback_host( - writer, poller, queue_client, response_queue, mock_hw, false, &sensor_buffer); + sensors::tasks::FDC1004 callback_host(writer, poller, queue_client, + response_queue, mock_hw, false, + &sensor_buffer); can::message_writer_task::TaskMessage empty_msg{}; @@ -771,7 +774,8 @@ SCENARIO("threshold configuration") { poller.set_queue(&poller_queue); auto sensor = sensors::tasks::CapacitiveMessageHandler{ - writer, poller, mock_hw, queue_client, response_queue, false, &sensor_buffer}; + writer, poller, mock_hw, queue_client, + response_queue, false, &sensor_buffer}; GIVEN("A request to set an autothreshold") { int NUM_READS = 10;