From 6b9807508e77539cca55efe132378f01b7ed0594 Mon Sep 17 00:00:00 2001 From: caila-marashaj Date: Thu, 4 Jan 2024 13:35:16 -0500 Subject: [PATCH] format --- .../sensors/core/tasks/pressure_driver.hpp | 33 ++++++++----------- include/sensors/simulation/mmr920C04.hpp | 6 ++-- pipettes/simulator/main.cpp | 6 ++-- sensors/tests/test_pressure_driver.cpp | 12 +++---- sensors/tests/test_pressure_sensor.cpp | 7 ++-- 5 files changed, 27 insertions(+), 37 deletions(-) diff --git a/include/sensors/core/tasks/pressure_driver.hpp b/include/sensors/core/tasks/pressure_driver.hpp index 0748f84c0..d4bca9123 100644 --- a/include/sensors/core/tasks/pressure_driver.hpp +++ b/include/sensors/core/tasks/pressure_driver.hpp @@ -33,9 +33,9 @@ template bool { return _initialized; } - auto register_map() -> mmr920::MMR920RegisterMap & { - return _registers; - } + auto register_map() -> mmr920::MMR920RegisterMap & { return _registers; } auto get_sensor_type() -> SensorType { return SensorType::pressure; } @@ -161,8 +159,8 @@ class MMR920 { } poller.continuous_single_register_poll( - mmr920::ADDRESS, command_data, 3, mode_delay_with_buffer, - own_queue, utils::build_id(mmr920::ADDRESS, command_data, tags)); + mmr920::ADDRESS, command_data, 3, mode_delay_with_buffer, own_queue, + utils::build_id(mmr920::ADDRESS, command_data, tags)); } auto poll_continuous_temperature(uint8_t tags) -> void { @@ -173,8 +171,8 @@ class MMR920 { build_register_command(_registers.temperature_command); poller.continuous_single_register_poll( - mmr920::ADDRESS, command_data, 3, mode_delay_with_buffer, - own_queue, utils::build_id(mmr920::ADDRESS, command_data, tags)); + mmr920::ADDRESS, command_data, 3, mode_delay_with_buffer, own_queue, + utils::build_id(mmr920::ADDRESS, command_data, tags)); } auto set_measure_mode(mmr920::MeasurementRate rate) -> bool { @@ -233,8 +231,8 @@ class MMR920 { } auto send_status(uint32_t message_index) -> void { - auto status = mmr920::StatusResult::to_status( - _registers.status_result.reading); + auto status = + mmr920::StatusResult::to_status(_registers.status_result.reading); auto message = can::messages::ReadFromSensorResponse{ .message_index = message_index, .sensor = get_sensor_type(), @@ -267,9 +265,8 @@ class MMR920 { } void stop_continuous_polling(uint32_t transaction_id, uint8_t reg_id) { - poller.continuous_single_register_poll(mmr920::ADDRESS, reg_id, 3, - STOP_DELAY, own_queue, - transaction_id); + poller.continuous_single_register_poll( + mmr920::ADDRESS, reg_id, 3, STOP_DELAY, own_queue, transaction_id); } auto handle_ongoing_pressure_response(i2c::messages::TransactionResponse &m) @@ -335,8 +332,7 @@ class MMR920 { .message_index = m.message_index, .sensor = can::ids::SensorType::pressure, .sensor_id = sensor_id, - .sensor_data = - mmr920::reading_to_fixed_point(pressure)}); + .sensor_data = mmr920::reading_to_fixed_point(pressure)}); } } @@ -378,8 +374,7 @@ class MMR920 { uint32_t shifted_data_store = temporary_data_store >> 8; - auto pressure = - mmr920::PressureResult::to_pressure(shifted_data_store); + auto pressure = mmr920::PressureResult::to_pressure(shifted_data_store); pressure_running_total += pressure; if (!m.id.is_completed_poll) { diff --git a/include/sensors/simulation/mmr920C04.hpp b/include/sensors/simulation/mmr920C04.hpp index b170ac5db..5355e7260 100644 --- a/include/sensors/simulation/mmr920C04.hpp +++ b/include/sensors/simulation/mmr920C04.hpp @@ -16,10 +16,8 @@ class MMR920 : public I2CRegisterMap { mmr920::ADDRESS, {{static_cast(mmr920::Registers::STATUS), 0xED}, {static_cast(mmr920::Registers::MEASURE_MODE_1), 0}, - {static_cast(mmr920::Registers::PRESSURE_READ), - 6000}, - {static_cast( - mmr920::Registers::LOW_PASS_PRESSURE_READ), + {static_cast(mmr920::Registers::PRESSURE_READ), 6000}, + {static_cast(mmr920::Registers::LOW_PASS_PRESSURE_READ), 6000}, {static_cast(mmr920::Registers::TEMPERATURE_READ), 3200}}) {} diff --git a/pipettes/simulator/main.cpp b/pipettes/simulator/main.cpp index 6c5b6d768..95c236c50 100644 --- a/pipettes/simulator/main.cpp +++ b/pipettes/simulator/main.cpp @@ -307,10 +307,8 @@ int main(int argc, char** argv) { auto fake_sensor_hw_secondary = std::make_shared(); fake_sensor_hw_secondary->provide_state_manager(state_manager_connection); - auto pressuresensor_i2c1 = - std::make_shared(); - auto pressuresensor_i2c3 = - std::make_shared(); + auto pressuresensor_i2c1 = std::make_shared(); + auto pressuresensor_i2c3 = std::make_shared(); i2c::hardware::SimI2C::DeviceMap sensor_map_i2c1 = { {hdcsensor->get_address(), *hdcsensor}, {pressuresensor_i2c1->get_address(), *pressuresensor_i2c1}}; diff --git a/sensors/tests/test_pressure_driver.cpp b/sensors/tests/test_pressure_driver.cpp index 3a40e553b..f7ee82a54 100644 --- a/sensors/tests/test_pressure_driver.cpp +++ b/sensors/tests/test_pressure_driver.cpp @@ -57,8 +57,8 @@ SCENARIO("Testing the pressure sensor driver") { queue_client.set_queue(&can_queue); writer.set_queue(&i2c_queue); poller.set_queue(&i2c_poll_queue); - sensors::tasks::MMR920 driver(writer, poller, queue_client, - pressure_queue, hardware, sensor_id); + sensors::tasks::MMR920 driver(writer, poller, queue_client, pressure_queue, + hardware, sensor_id); can::message_writer_task::TaskMessage empty_can_msg{}; @@ -69,8 +69,8 @@ SCENARIO("Testing the pressure sensor driver") { i2c::messages::TransactionIdentifier{ .token = sensors::utils::build_id( sensors::mmr920::ADDRESS, - static_cast(sensors::mmr920::Registers:: - LOW_PASS_PRESSURE_READ), + static_cast( + sensors::mmr920::Registers::LOW_PASS_PRESSURE_READ), 0x1), .is_completed_poll = 1, .transaction_index = 0}, @@ -137,8 +137,8 @@ SCENARIO("Testing the pressure sensor driver") { i2c::messages::TransactionIdentifier{ .token = sensors::utils::build_id( sensors::mmr920::ADDRESS, - static_cast(sensors::mmr920::Registers:: - LOW_PASS_PRESSURE_READ), + static_cast( + sensors::mmr920::Registers::LOW_PASS_PRESSURE_READ), sensors::utils::byte_from_tags(tags_for_baseline)), .is_completed_poll = 1, .transaction_index = 0}, diff --git a/sensors/tests/test_pressure_sensor.cpp b/sensors/tests/test_pressure_sensor.cpp index a82a62cf8..02e956dd3 100644 --- a/sensors/tests/test_pressure_sensor.cpp +++ b/sensors/tests/test_pressure_sensor.cpp @@ -65,8 +65,8 @@ SCENARIO("Receiving messages through the pressure sensor message handler") { i2c::messages::TransactionIdentifier{ .token = sensors::utils::build_id( sensors::mmr920::ADDRESS, - static_cast(sensors::mmr920::Registers:: - LOW_PASS_PRESSURE_READ), + static_cast( + sensors::mmr920::Registers::LOW_PASS_PRESSURE_READ), 0x1), .is_completed_poll = 1, .transaction_index = 0}, @@ -139,8 +139,7 @@ SCENARIO("Receiving messages through the pressure sensor message handler") { sensors::utils::ResponseTag::IS_THRESHOLD_SENSE}; response_details.id.token = sensors::utils::build_id( sensors::mmr920::ADDRESS, - static_cast( - sensors::mmr920::Registers::MACRAM_WRITE), + static_cast(sensors::mmr920::Registers::MACRAM_WRITE), sensors::utils::byte_from_tags(tags_for_baseline)); auto response_read = sensors::utils::TaskMessage(response_details); sensor.handle_message(response_read);