diff --git a/ROMFS/cannode/init.d/rcS b/ROMFS/cannode/init.d/rcS index cfb5a93927..6e53056245 100644 --- a/ROMFS/cannode/init.d/rcS +++ b/ROMFS/cannode/init.d/rcS @@ -88,7 +88,7 @@ unset BOARD_RC_SENSORS # Check for flow sensor if param compare SENS_EN_PX4FLOW 1 then - px4flow start -X + px4flow start -X & fi uavcannode start diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 16e6e8c545..0345a507bb 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -101,12 +101,6 @@ then pmw3901 -S start fi -# Check for px4flow sensor -if param compare -s SENS_EN_PX4FLOW 1 -then - px4flow start -X -fi - # vl53l1x i2c distance sensor if param compare -s SENS_EN_VL53L1X 1 then @@ -198,9 +192,3 @@ then # start last (wait for possible icm20948 passthrough mode) ak09916 -X -q start fi - -############################################################################### -# End Optional drivers # -############################################################################### - -sensors start diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 940b690a5a..cc114cc635 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -405,6 +405,7 @@ else battery_status start fi + sensors start commander start fi @@ -508,6 +509,12 @@ else gyro_calibration start 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 # diff --git a/src/drivers/optical_flow/px4flow/px4flow.cpp b/src/drivers/optical_flow/px4flow/px4flow.cpp index 5f9625cb2e..c1c59ed7a9 100644 --- a/src/drivers/optical_flow/px4flow/px4flow.cpp +++ b/src/drivers/optical_flow/px4flow/px4flow.cpp @@ -406,6 +406,14 @@ px4flow_main(int argc, char *argv[]) BusInstanceIterator iterator(MODULE_NAME, cli, DRV_FLOW_DEVTYPE_PX4FLOW); 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); }