Skip to content

Commit

Permalink
calculate the baseline correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jun 4, 2024
1 parent 311d42f commit d29b0ce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class MMR920 {
}
}
if (bind_sync) {
if (std::fabs(pressure) - std::fabs(current_pressure_baseline_pa) >
if (std::fabs(pressure - current_pressure_baseline_pa) >
threshold_pascals) {
hardware.set_sync();
} else {
Expand All @@ -364,8 +364,7 @@ class MMR920 {
}

if (echo_this_time) {
auto response_pressure = (pressure < 0 ? -1 : 1) * (
std::fabs(pressure) - std::fabs(current_pressure_baseline_pa));
auto response_pressure = pressure - current_pressure_baseline_pa;
#ifdef USE_PRESSURE_MOVE
if (pressure_buffer_index < PRESSURE_SENSOR_BUFFER_SIZE) {
(*p_buff).at(pressure_buffer_index) = response_pressure;
Expand Down

0 comments on commit d29b0ce

Please sign in to comment.