OpticalFlow: move onboard alloc to init()

No reason to keep it in the constructor
This commit is contained in:
Julien Beraud 2016-11-15 17:49:19 +01:00 committed by Andrew Tridgell
parent f3f1f6b0b6
commit dc86a53862
1 changed files with 4 additions and 6 deletions

View File

@ -67,12 +67,6 @@ OpticalFlow::OpticalFlow(AP_AHRS_NavEKF &ahrs)
// healthy flag will be overwritten on update
_flags.healthy = false;
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP ||\
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE ||\
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
backend = new AP_OpticalFlow_Onboard(*this, ahrs);
#endif
}
void OpticalFlow::init(void)
@ -84,6 +78,10 @@ void OpticalFlow::init(void)
backend = new AP_OpticalFlow_HIL(*this);
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
backend = new AP_OpticalFlow_Linux(*this, hal.i2c_mgr->get_device(HAL_OPTFLOW_PX4FLOW_I2C_BUS, HAL_OPTFLOW_PX4FLOW_I2C_ADDRESS));
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP ||\
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE ||\
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
backend = new AP_OpticalFlow_Onboard(*this, ahrs);
#endif
}