AP_OpticalFlow: fix example when OpticalFlow compiled out

This commit is contained in:
Peter Barker 2022-01-06 09:24:38 +11:00 committed by Peter Barker
parent 5a421c7eb3
commit d86c1c6fd1

View File

@ -31,7 +31,9 @@ public:
}; };
static DummyVehicle vehicle; static DummyVehicle vehicle;
#if AP_OPTICALFLOW_ENABLED
static OpticalFlow optflow; static OpticalFlow optflow;
#endif
void setup() void setup()
{ {
@ -39,12 +41,16 @@ void setup()
hal.scheduler->delay(1000); hal.scheduler->delay(1000);
#if AP_OPTICALFLOW_ENABLED
// flowSensor initialization // flowSensor initialization
optflow.init(-1); optflow.init(-1);
if (!optflow.healthy()) { if (!optflow.healthy()) {
hal.console->printf("Failed to initialise PX4Flow "); hal.console->printf("Failed to initialise OpticalFlow");
} }
#else
hal.console->printf("OpticalFlow compiled out");
#endif
hal.scheduler->delay(1000); hal.scheduler->delay(1000);
} }