Skip to content

Commit

Permalink
ArduPlane: create and use AP_OPTICALFLOW_ENABLED
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and tridge committed Dec 29, 2021
1 parent f361d9b commit e55eea9
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ArduPlane/ArduPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const AP_Scheduler::Task Plane::scheduler_tasks[] = {
SCHED_TASK(read_rangefinder, 50, 100, 78),
SCHED_TASK_CLASS(AP_ICEngine, &plane.g2.ice_control, update, 10, 100, 81),
SCHED_TASK_CLASS(Compass, &plane.compass, cal_update, 50, 50, 84),
#if OPTFLOW == ENABLED
#if AP_OPTICALFLOW_ENABLED
SCHED_TASK_CLASS(OpticalFlow, &plane.optflow, update, 50, 50, 87),
#endif
SCHED_TASK(one_second_loop, 1, 400, 90),
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/GCS_Plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void GCS_Plane::update_vehicle_sensor_status_flags(void)
control_sensors_health |= MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION;
}

#if OPTFLOW == ENABLED
#if AP_OPTICALFLOW_ENABLED
const OpticalFlow *optflow = AP::opticalflow();
if (optflow && optflow->enabled()) {
control_sensors_present |= MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW;
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ const AP_Param::Info Plane::var_info[] = {
GOBJECT(afs, "AFS_", AP_AdvancedFailsafe),
#endif

#if OPTFLOW == ENABLED
#if AP_OPTICALFLOW_ENABLED
// @Group: FLOW
// @Path: ../libraries/AP_OpticalFlow/AP_OpticalFlow.cpp
GOBJECT(optflow, "FLOW", OpticalFlow),
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/Plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Plane : public AP_Vehicle {
AP_Camera camera{MASK_LOG_CAMERA};
#endif

#if OPTFLOW == ENABLED
#if AP_OPTICALFLOW_ENABLED
// Optical flow sensor
OpticalFlow optflow;
#endif
Expand Down
9 changes: 0 additions & 9 deletions ArduPlane/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@
#endif


//////////////////////////////////////////////////////////////////////////////
// Optical flow sensor support
//

#ifndef OPTFLOW
# define OPTFLOW ENABLED
#endif


//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// RADIO CONFIGURATION
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void Plane::init_ardupilot()
reset_control_switch();

// initialise sensor
#if OPTFLOW == ENABLED
#if AP_OPTICALFLOW_ENABLED
if (optflow.enabled()) {
optflow.init(-1);
}
Expand Down

0 comments on commit e55eea9

Please sign in to comment.