1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +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

@ -78,6 +78,7 @@
#include "sensors/compass.h"
#include "sensors/esc_sensor.h"
#include "sensors/gyro.h"
#include "sensors/rangefinder.h"
#include "telemetry/frsky.h"
#include "telemetry/telemetry.h"
@ -109,6 +110,11 @@ const char * const lookupTableMagHardware[] = {
"AUTO", "NONE", "HMC5883", "AK8975", "AK8963"
};
#endif
#if defined(USE_SENSOR_NAMES) || defined(USE_RANGEFINDER)
const char * const lookupTableRangefinderHardware[] = {
"NONE", "HCSR04"
};
#endif
static const char * const lookupTableOffOn[] = {
"OFF", "ON"
@ -318,6 +324,9 @@ const lookupTableEntry_t lookupTables[] = {
#ifdef USE_MAX7456
{ lookupTableMax7456Clock, sizeof(lookupTableMax7456Clock) / sizeof(char *) },
#endif
#ifdef USE_RANGEFINDER
{ lookupTableRangefinderHardware, sizeof(lookupTableRangefinderHardware) / sizeof(char *) },
#endif
};
const clivalue_t valueTable[] = {
@ -829,6 +838,11 @@ const clivalue_t valueTable[] = {
{ "camera_control_key_delay", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 100, 500 }, PG_CAMERA_CONTROL_CONFIG, offsetof(cameraControlConfig_t, keyDelayMs) },
{ "camera_control_internal_resistance", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 10, 1000 }, PG_CAMERA_CONTROL_CONFIG, offsetof(cameraControlConfig_t, internalResistance) },
#endif
// PG_RANGEFINDER_CONFIG
#ifdef USE_RANGEFINDER
{ "rangefinder_hardware", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_RANGEFINDER_HARDWARE }, PG_RANGEFINDER_CONFIG, offsetof(rangefinderConfig_t, rangefinder_hardware) },
#endif
};
const uint16_t valueTableEntryCount = ARRAYLEN(valueTable);