mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 11:43:34 +08:00
uORB: introduce SubscriptionMultiArray for working with multi-instances
This commit is contained in:
@@ -105,7 +105,7 @@ class UavcanCDevSensorBridgeBase : public IUavcanSensorBridge, public device::CD
|
||||
bool _out_of_channels = false;
|
||||
|
||||
protected:
|
||||
static constexpr unsigned DEFAULT_MAX_CHANNELS = ORB_MULTI_MAX_INSTANCES;
|
||||
static constexpr unsigned DEFAULT_MAX_CHANNELS = 4;
|
||||
const unsigned _max_channels;
|
||||
|
||||
UavcanCDevSensorBridgeBase(const char *name, const char *devname, const char *class_devname,
|
||||
|
||||
@@ -380,7 +380,7 @@ void UavcanNode::Run()
|
||||
}
|
||||
|
||||
// distance_sensor[] -> uavcan::equipment::range_sensor::Measurement
|
||||
for (int i = 0; i < ORB_MULTI_MAX_INSTANCES; i++) {
|
||||
for (int i = 0; i < MAX_INSTANCES; i++) {
|
||||
distance_sensor_s dist;
|
||||
|
||||
if (_distance_sensor_sub[i].update(&dist)) {
|
||||
|
||||
@@ -183,7 +183,8 @@ private:
|
||||
|
||||
uORB::SubscriptionCallbackWorkItem _battery_status_sub{this, ORB_ID(battery_status)};
|
||||
uORB::SubscriptionCallbackWorkItem _diff_pressure_sub{this, ORB_ID(differential_pressure)};
|
||||
uORB::SubscriptionCallbackWorkItem _distance_sensor_sub[ORB_MULTI_MAX_INSTANCES] {
|
||||
static constexpr int MAX_INSTANCES = 4;
|
||||
uORB::SubscriptionCallbackWorkItem _distance_sensor_sub[MAX_INSTANCES] {
|
||||
{this, ORB_ID(distance_sensor), 0},
|
||||
{this, ORB_ID(distance_sensor), 1},
|
||||
{this, ORB_ID(distance_sensor), 2},
|
||||
|
||||
Reference in New Issue
Block a user