Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sensors): send the pressure sensor response with the baseline applied #783

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format
  • Loading branch information
ryanthecoder committed Jun 3, 2024
commit 653afd10d785fb652773ea5fe44bdace6280629d
21 changes: 10 additions & 11 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
@@ -365,22 +365,21 @@ class MMR920 {

if (echo_this_time) {
auto response_pressure =
std::fabs(pressure) -
std::fabs(current_pressure_baseline_pa);
std::fabs(pressure) - std::fabs(current_pressure_baseline_pa);
#ifdef USE_PRESSURE_MOVE
if (pressure_buffer_index < PRESSURE_SENSOR_BUFFER_SIZE) {
if (pressure_buffer_index < PRESSURE_SENSOR_BUFFER_SIZE) {
(*p_buff).at(pressure_buffer_index) = response_pressure;
pressure_buffer_index++;
}
#else
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::ReadFromSensorResponse{
.message_index = m.message_index,
.sensor = can::ids::SensorType::pressure,
.sensor_id = sensor_id,
.sensor_data = mmr920::reading_to_fixed_point(
response_pressure)});
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::ReadFromSensorResponse{
.message_index = m.message_index,
.sensor = can::ids::SensorType::pressure,
.sensor_id = sensor_id,
.sensor_data =
mmr920::reading_to_fixed_point(response_pressure)});
#endif
}
}
Loading