Skip to content

Commit

Permalink
applications: asset_tracker_v2: Fix air pressure value
Browse files Browse the repository at this point in the history
Air pressure value was scaled incorrectly and the values
sent to the cloud were not in Pascals. When the BSEC
library is used, the value is already in Pascals and no
scaling is needed, however the BME680 driver reports the
pressure in kPascals.

Signed-off-by: Tommi Kangas <[email protected]>
  • Loading branch information
tokangas authored and cvinayak committed Dec 28, 2023
1 parent 7709239 commit 6252581
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion applications/asset_tracker_v2/src/ext_sensors/ext_sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,13 @@ int ext_sensors_pressure_get(double *ext_press)
}

k_spinlock_key_t key = k_spin_lock(&(press_sensor.lock));
*ext_press = sensor_value_to_double(&data) / 1000.0f;
#if defined(CONFIG_BME680)
/* Pressure is in kPascals */
*ext_press = sensor_value_to_double(&data) * 1000.0f;
#else
/* Pressure is in Pascals */
*ext_press = sensor_value_to_double(&data);
#endif
k_spin_unlock(&(press_sensor.lock), key);

return 0;
Expand Down

0 comments on commit 6252581

Please sign in to comment.