mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 00:41:36 +08:00
Allow negative differential pressure if parameter enabled (#24434)
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "AUAV_Differential.hpp"
|
||||
#include <parameters/param.h>
|
||||
|
||||
AUAV_Differential::AUAV_Differential(const I2CSPIDriverConfig &config) :
|
||||
AUAV(config)
|
||||
@@ -46,6 +47,14 @@ void AUAV_Differential::publish_pressure(const float pressure_p, const float tem
|
||||
differential_pressure.timestamp_sample = timestamp_sample;
|
||||
differential_pressure.device_id = get_device_id();
|
||||
differential_pressure.differential_pressure_pa = pressure_p;
|
||||
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_p;
|
||||
}
|
||||
|
||||
differential_pressure.temperature = temperature_c;
|
||||
differential_pressure.error_count = perf_event_count(_comms_errors);
|
||||
_differential_pressure_pub.publish(differential_pressure);
|
||||
|
||||
Reference in New Issue
Block a user