mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 22:30:36 +08:00
MS5837: correct unit conversion to Pascal
This commit is contained in:
@@ -332,14 +332,13 @@ int MS5837::_collect()
|
||||
|
||||
} else {
|
||||
/* pressure calculation, result in Pa */
|
||||
int32_t P = (((raw * _SENS) >> 21) - _OFF) >> 13;
|
||||
|
||||
int32_t pressure_pascal = ((((raw * _SENS) >> 21) - _OFF) >> 13) * 10;
|
||||
|
||||
// publish
|
||||
sensor_baro_s sensor_baro{};
|
||||
sensor_baro.timestamp_sample = timestamp_sample;
|
||||
sensor_baro.device_id = get_device_id();
|
||||
sensor_baro.pressure = P;
|
||||
sensor_baro.pressure = pressure_pascal;
|
||||
sensor_baro.temperature = _last_temperature;
|
||||
sensor_baro.error_count = perf_event_count(_comms_errors);
|
||||
sensor_baro.timestamp = hrt_absolute_time();
|
||||
|
||||
Reference in New Issue
Block a user