mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_OpticalFlow: auto-start px4flow driver if enabled
This commit is contained in:
parent
74182b6b3d
commit
78b2924c00
@ -24,6 +24,7 @@
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
||||
|
||||
#include <AP_BoardConfig/AP_BoardConfig.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@ -39,8 +40,18 @@ OpticalFlow_backend(_frontend)
|
||||
{}
|
||||
|
||||
|
||||
extern "C" int px4flow_main(int, char **);
|
||||
|
||||
void AP_OpticalFlow_PX4::init(void)
|
||||
{
|
||||
#if defined(CONFIG_ARCH_BOARD_PX4FMU_V1) || defined(CONFIG_ARCH_BOARD_PX4FMU_V2)
|
||||
if (!AP_BoardConfig::px4_start_driver(px4flow_main, "px4flow", "start")) {
|
||||
hal.console->printf("Unable to start px4flow driver\n");
|
||||
} else {
|
||||
// give it time to initialise
|
||||
hal.scheduler->delay(500);
|
||||
}
|
||||
#endif
|
||||
_fd = open(PX4FLOW0_DEVICE_PATH, O_RDONLY);
|
||||
|
||||
// check for failure to open device
|
||||
|
Loading…
Reference in New Issue
Block a user