mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 17:01:35 +08:00
Allow negative differential pressure if parameter enabled (#24434)
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include "ASP5033.hpp"
|
||||
#include <parameters/param.h>
|
||||
|
||||
ASP5033::ASP5033(const I2CSPIDriverConfig &config) :
|
||||
I2C(config),
|
||||
@@ -232,6 +233,15 @@ int ASP5033::collect()
|
||||
differential_pressure.timestamp_sample = timestamp_sample;
|
||||
differential_pressure.device_id = get_device_id();
|
||||
differential_pressure.differential_pressure_pa = _pressure;
|
||||
int32_t differential_press_rev = 0;
|
||||
param_get(param_find("SENS_DPRES_REV"), &differential_press_rev);
|
||||
|
||||
//If differential pressure reverse param set, swap positive and negative
|
||||
if (differential_press_rev == 1) {
|
||||
differential_pressure.differential_pressure_pa = -1.0f * _pressure;
|
||||
}
|
||||
|
||||
|
||||
differential_pressure.temperature = _temperature ;
|
||||
differential_pressure.error_count = perf_event_count(_comms_errors);
|
||||
differential_pressure.timestamp = timestamp_sample;
|
||||
|
||||
Reference in New Issue
Block a user