Skip to content

Commit

Permalink
format + fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Jun 12, 2024
1 parent fb23053 commit a7e431d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/sensors/core/tasks/capacitive_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions include/sensors/core/tasks/capacitive_sensor_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CapacitiveMessageHandler {
sensors::hardware::SensorHardwareBase &hardware, CanClient &can_client,
OwnQueue &own_queue, bool shared_task,
std::array<float, SENSOR_BUFFER_SIZE> *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;
Expand Down Expand Up @@ -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{};
Expand Down
6 changes: 3 additions & 3 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) = response_pressure;
(*sensor_buffer).at(sensor_buffer_index) = data;
sensor_buffer_index++;
}

Expand Down Expand Up @@ -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);
Expand Down
14 changes: 9 additions & 5 deletions sensors/tests/test_capacitive_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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{};

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a7e431d

Please sign in to comment.