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
1 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,9 @@ public:
};
static DummyVehicle vehicle;
#if AP_OPTICALFLOW_ENABLED
static OpticalFlow optflow;
#endif
void setup()
{
@ -39,12 +41,16 @@ void setup()
hal.scheduler->delay(1000);
#if AP_OPTICALFLOW_ENABLED
// flowSensor initialization
optflow.init(-1);
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);
}