px4flow allow delayed background startup

This commit is contained in:
Daniel Agar
2022-04-22 15:40:06 -04:00
parent fef47513f5
commit 9073f3ccdf
4 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ unset BOARD_RC_SENSORS
# Check for flow sensor # Check for flow sensor
if param compare SENS_EN_PX4FLOW 1 if param compare SENS_EN_PX4FLOW 1
then then
px4flow start -X px4flow start -X &
fi fi
uavcannode start uavcannode start
-12
View File
@@ -101,12 +101,6 @@ then
pmw3901 -S start pmw3901 -S start
fi fi
# Check for px4flow sensor
if param compare -s SENS_EN_PX4FLOW 1
then
px4flow start -X
fi
# vl53l1x i2c distance sensor # vl53l1x i2c distance sensor
if param compare -s SENS_EN_VL53L1X 1 if param compare -s SENS_EN_VL53L1X 1
then then
@@ -198,9 +192,3 @@ then
# start last (wait for possible icm20948 passthrough mode) # start last (wait for possible icm20948 passthrough mode)
ak09916 -X -q start ak09916 -X -q start
fi fi
###############################################################################
# End Optional drivers #
###############################################################################
sensors start
+7
View File
@@ -405,6 +405,7 @@ else
battery_status start battery_status start
fi fi
sensors start
commander start commander start
fi fi
@@ -508,6 +509,12 @@ else
gyro_calibration start gyro_calibration start
fi fi
# Check for px4flow sensor
if param compare -s SENS_EN_PX4FLOW 1
then
px4flow start -X &
fi
# #
# Optional board supplied extras: rc.board_extras # Optional board supplied extras: rc.board_extras
# #
@@ -406,6 +406,14 @@ px4flow_main(int argc, char *argv[])
BusInstanceIterator iterator(MODULE_NAME, cli, DRV_FLOW_DEVTYPE_PX4FLOW); BusInstanceIterator iterator(MODULE_NAME, cli, DRV_FLOW_DEVTYPE_PX4FLOW);
if (!strcmp(verb, "start")) { if (!strcmp(verb, "start")) {
// px4flow can require more time to fully start and be accessible
static constexpr uint64_t STARTUP_MIN_TIME_US = 6'000'000;
const hrt_abstime time_now_us = hrt_absolute_time();
if (time_now_us < STARTUP_MIN_TIME_US) {
px4_usleep(STARTUP_MIN_TIME_US - time_now_us);
}
return ThisDriver::module_start(cli, iterator); return ThisDriver::module_start(cli, iterator);
} }