mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 00:31:36 +08:00
uavcannode: add CANNODE_PUB_BAR and CANNODE_PUB_MAG parameters to optionally disable baro and mag data publication (#26324)
This commit is contained in:
@@ -384,7 +384,13 @@ int UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events
|
||||
#endif // CONFIG_UAVCANNODE_GNSS_FIX
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_MAGNETIC_FIELD_STRENGTH)
|
||||
_publisher_list.add(new MagneticFieldStrength2(this, _node));
|
||||
int32_t cannode_pub_mag = 1;
|
||||
param_get(param_find("CANNODE_PUB_MAG"), &cannode_pub_mag);
|
||||
|
||||
if (cannode_pub_mag == 1) {
|
||||
_publisher_list.add(new MagneticFieldStrength2(this, _node));
|
||||
}
|
||||
|
||||
#endif // CONFIG_UAVCANNODE_MAGNETIC_FIELD_STRENGTH
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_RANGE_SENSOR_MEASUREMENT)
|
||||
@@ -421,12 +427,25 @@ int UavcanNode::init(uavcan::NodeID node_id, UAVCAN_DRIVER::BusEvent &bus_events
|
||||
_publisher_list.add(new SafetyButton(this, _node));
|
||||
#endif // CONFIG_UAVCANNODE_SAFETY_BUTTON
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_STATIC_PRESSURE) || defined(CONFIG_UAVCANNODE_STATIC_TEMPERATURE)
|
||||
int32_t cannode_pub_bar = 1;
|
||||
param_get(param_find("CANNODE_PUB_BAR"), &cannode_pub_bar);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_STATIC_PRESSURE)
|
||||
_publisher_list.add(new StaticPressure(this, _node));
|
||||
|
||||
if (cannode_pub_bar == 1) {
|
||||
_publisher_list.add(new StaticPressure(this, _node));
|
||||
}
|
||||
|
||||
#endif // CONFIG_UAVCANNODE_STATIC_PRESSURE
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_STATIC_TEMPERATURE)
|
||||
_publisher_list.add(new StaticTemperature(this, _node));
|
||||
|
||||
if (cannode_pub_bar == 1) {
|
||||
_publisher_list.add(new StaticTemperature(this, _node));
|
||||
}
|
||||
|
||||
#endif // CONFIG_UAVCANNODE_STATIC_TEMPERATURE
|
||||
|
||||
#if defined(CONFIG_UAVCANNODE_ARMING_STATUS)
|
||||
|
||||
@@ -94,3 +94,29 @@ PARAM_DEFINE_INT32(CANNODE_PUB_MBD, 0);
|
||||
* @group UAVCAN
|
||||
*/
|
||||
PARAM_DEFINE_INT32(CANNODE_PUB_IMU, 0);
|
||||
|
||||
/**
|
||||
* Enable barometer publication
|
||||
*
|
||||
* Enables publication of static pressure and static temperature
|
||||
* from the barometer sensor over UAVCAN.
|
||||
*
|
||||
* @boolean
|
||||
* @max 1
|
||||
* @reboot_required true
|
||||
* @group UAVCAN
|
||||
*/
|
||||
PARAM_DEFINE_INT32(CANNODE_PUB_BAR, 1);
|
||||
|
||||
/**
|
||||
* Enable magnetometer publication
|
||||
*
|
||||
* Enables publication of magnetic field strength
|
||||
* from the magnetometer sensor over UAVCAN.
|
||||
*
|
||||
* @boolean
|
||||
* @max 1
|
||||
* @reboot_required true
|
||||
* @group UAVCAN
|
||||
*/
|
||||
PARAM_DEFINE_INT32(CANNODE_PUB_MAG, 1);
|
||||
|
||||
Reference in New Issue
Block a user