1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Port iNav's rangefinder

This commit is contained in:
jflyper 2017-12-14 23:44:22 +09:00
parent 8a9fd29dd3
commit 11c47c631b
53 changed files with 898 additions and 492 deletions

View file

@ -35,24 +35,12 @@
#include "sensors/barometer.h"
#include "sensors/gyro.h"
#include "sensors/compass.h"
#include "sensors/sonar.h"
#include "sensors/rangefinder.h"
#include "sensors/initialisation.h"
uint8_t detectedSensors[SENSOR_INDEX_COUNT] = { GYRO_NONE, ACC_NONE, BARO_NONE, MAG_NONE };
#ifdef USE_SONAR
static bool sonarDetect(void)
{
if (feature(FEATURE_SONAR)) {
// the user has set the sonar feature, so assume they have an HC-SR04 plugged in,
// since there is no way to detect it
sensorsSet(SENSOR_SONAR);
return true;
}
return false;
}
#endif
// requestedSensors is not actually used
uint8_t requestedSensors[SENSOR_INDEX_COUNT] = { GYRO_NONE, ACC_NONE, BARO_NONE, MAG_NONE, RANGEFINDER_NONE };
uint8_t detectedSensors[SENSOR_INDEX_COUNT] = { GYRO_NONE, ACC_NONE, BARO_NONE, MAG_NONE, RANGEFINDER_NONE };
bool sensorsAutodetect(void)
{
@ -73,10 +61,8 @@ bool sensorsAutodetect(void)
baroDetect(&baro.dev, barometerConfig()->baro_hardware);
#endif
#ifdef USE_SONAR
if (sonarDetect()) {
sonarInit(sonarConfig());
}
#ifdef USE_RANGEFINDER
rangefinderInit();
#endif
return gyroDetected;