mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
define RANGEFINDER renamed to USE_RANGEFINDER
This commit is contained in:
parent
bdba06aac1
commit
4291011e2a
28 changed files with 40 additions and 41 deletions
|
@ -213,7 +213,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = {
|
|||
#ifdef PITOT
|
||||
{"AirSpeed", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_PITOT},
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
{"sonarRaw", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_SONAR},
|
||||
#endif
|
||||
{"rssi", -1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(UNSIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_RSSI},
|
||||
|
@ -352,7 +352,7 @@ typedef struct blackboxMainState_s {
|
|||
#ifdef MAG
|
||||
int16_t magADC[XYZ_AXIS_COUNT];
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
int32_t sonarRaw;
|
||||
#endif
|
||||
uint16_t rssi;
|
||||
|
@ -500,7 +500,7 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition)
|
|||
return feature(FEATURE_CURRENT_METER) && batteryConfig()->currentMeterType == CURRENT_SENSOR_ADC;
|
||||
|
||||
case FLIGHT_LOG_FIELD_CONDITION_SONAR:
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
return sensors(SENSOR_RANGEFINDER);
|
||||
#else
|
||||
return false;
|
||||
|
@ -634,7 +634,7 @@ static void writeIntraframe(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SONAR)) {
|
||||
blackboxWriteSignedVB(blackboxCurrent->sonarRaw);
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ static void writeInterframe(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SONAR)) {
|
||||
deltas[optionalFieldCount++] = blackboxCurrent->sonarRaw - blackboxLast->sonarRaw;
|
||||
}
|
||||
|
@ -1144,7 +1144,7 @@ static void loadMainState(timeUs_t currentTimeUs)
|
|||
blackboxCurrent->airSpeed = pitot.airSpeed;
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
// Store the raw sonar value without applying tilt correction
|
||||
blackboxCurrent->sonarRaw = rangefinderRead();
|
||||
#endif
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef struct drv_pwm_config_s {
|
|||
bool useFastPwm;
|
||||
bool useSoftSerial;
|
||||
bool useLEDStrip;
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
bool useSonar;
|
||||
#endif
|
||||
#ifdef USE_SERVOS
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#if defined(RANGEFINDER) && defined(USE_RANGEFINDER_SRF10)
|
||||
#if defined(USE_RANGEFINDER) && defined(USE_RANGEFINDER_SRF10)
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ typedef enum {
|
|||
#ifdef MAG
|
||||
TABLE_MAG_HARDWARE,
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
TABLE_RANGEFINDER_HARDWARE, // currently not used
|
||||
#endif
|
||||
#ifdef PITOT
|
||||
|
@ -428,7 +428,7 @@ static const lookupTableEntry_t lookupTables[] = {
|
|||
#ifdef MAG
|
||||
{ lookupTableMagHardware, sizeof(lookupTableMagHardware) / sizeof(char *) },
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
{ lookupTableRangefinderHardware, sizeof(lookupTableRangefinderHardware) / sizeof(char *) },
|
||||
#endif
|
||||
#ifdef PITOT
|
||||
|
@ -548,7 +548,7 @@ static const clivalue_t valueTable[] = {
|
|||
{ "accgain_z", VAR_INT16 | MASTER_VALUE, .config.minmax = { 1, 8192 }, PG_ACCELEROMETER_CONFIG, offsetof(accelerometerConfig_t, accGain.raw[Z]) },
|
||||
|
||||
// PG_RANGEFINDER_CONFIG
|
||||
#ifdef RANGEFINDER
|
||||
#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
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
break;
|
||||
|
||||
case MSP_SONAR_ALTITUDE:
|
||||
#if defined(RANGEFINDER)
|
||||
#ifdef(USE_RANGEFINDER)
|
||||
sbufWriteU32(dst, rangefinderGetLatestAltitude());
|
||||
#else
|
||||
sbufWriteU32(dst, 0);
|
||||
|
@ -1152,7 +1152,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
sbufWriteU8(dst, rangefinderConfig()->rangefinder_hardware);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
|
@ -1663,7 +1663,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
#else
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
rangefinderConfigMutable()->rangefinder_hardware = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src); // rangefinder hardware
|
||||
|
|
|
@ -173,7 +173,7 @@ void taskUpdatePitot(timeUs_t currentTimeUs)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
void taskUpdateRangefinder(timeUs_t currentTimeUs)
|
||||
{
|
||||
UNUSED(currentTimeUs);
|
||||
|
@ -302,7 +302,7 @@ void fcTasksInit(void)
|
|||
#ifdef PITOT
|
||||
setTaskEnabled(TASK_PITOT, sensors(SENSOR_PITOT));
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
setTaskEnabled(TASK_RANGEFINDER, sensors(SENSOR_RANGEFINDER));
|
||||
#endif
|
||||
#ifdef USE_DASHBOARD
|
||||
|
@ -451,7 +451,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
},
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
[TASK_RANGEFINDER] = {
|
||||
.taskName = "RANGEFINDER",
|
||||
.taskFunc = taskUpdateRangefinder,
|
||||
|
|
|
@ -469,8 +469,7 @@ static void updatePitotTopic(timeUs_t currentTimeUs)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(RANGEFINDER)
|
||||
#ifdef(USE_RANGEFINDER)
|
||||
/**
|
||||
* Read sonar and update alt/vel topic
|
||||
* Function is called from TASK_RANGEFINDER at arbitrary rate - as soon as new measurements are available
|
||||
|
@ -810,7 +809,7 @@ static void updateEstimatedTopic(timeUs_t currentTimeUs)
|
|||
}
|
||||
|
||||
/* Surface offset */
|
||||
#if defined(RANGEFINDER)
|
||||
#ifdef(USE_RANGEFINDER)
|
||||
posEstimator.est.surface = posEstimator.est.surface + posEstimator.est.surfaceVel * dt;
|
||||
|
||||
if (isSonarValid) {
|
||||
|
|
|
@ -77,7 +77,7 @@ typedef enum {
|
|||
#ifdef PITOT
|
||||
TASK_PITOT,
|
||||
#endif
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
TASK_RANGEFINDER,
|
||||
#endif
|
||||
#ifdef USE_DASHBOARD
|
||||
|
|
|
@ -113,7 +113,7 @@ hardwareSensorStatus_e getHwBarometerStatus(void)
|
|||
|
||||
hardwareSensorStatus_e getHwRangefinderStatus(void)
|
||||
{
|
||||
#if defined(RANGEFINDER)
|
||||
#if defined(USE_RANGEFINDER)
|
||||
if (detectedSensors[SENSOR_INDEX_RANGEFINDER] != RANGEFINDER_NONE) {
|
||||
if (rangefinderIsHealthy()) {
|
||||
return HW_SENSOR_OK;
|
||||
|
|
|
@ -66,7 +66,7 @@ bool sensorsAutodetect(void)
|
|||
compassInit();
|
||||
#endif
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
rangefinderInit();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ rangefinder_t rangefinder;
|
|||
|
||||
#define RANGEFINDER_HARDWARE_TIMEOUT_MS 500 // Accept 500ms of non-responsive sensor, report HW failure otherwise
|
||||
|
||||
#ifdef RANGEFINDER
|
||||
#ifdef USE_RANGEFINDER
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(rangefinderConfig_t, rangefinderConfig, PG_RANGEFINDER_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(rangefinderConfig_t, rangefinderConfig,
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
|
||||
//#define USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
//#define USE_RANGEFINDER_HCSR04
|
||||
//#define USE_RANGEFINDER_SRF10
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB0
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
#define I2C3_SCL PA8
|
||||
#define I2C3_SDA PC9
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB8
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB9
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#define USE_MAG_AK8975
|
||||
#define MAG_AK8975_ALIGN CW180_DEG_FLIP
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
//#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
// USART2, PA3
|
||||
#define BIND_PIN PA3
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PA7
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PA2
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
#define VBAT_SCALE_DEFAULT 103
|
||||
|
||||
// *************** RANGEFINDER *****************************
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
// #define RANGEFINDER_HCSR04_TRIGGER_PIN PB10
|
||||
// #define RANGEFINDER_HCSR04_ECHO_PIN PB11
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
#define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
|
||||
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
#define USE_MAG_HMC5883
|
||||
#define MAG_HMC5883_ALIGN CW180_DEG
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
// #define USE_RANGEFINDER_SRF10
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#define MAG
|
||||
#define USE_MAG_HMC5883
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0 // RX7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RX8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#define USE_MAG_HMC5883 // External
|
||||
#define USE_MAG_MAG3110 // External
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB2 // Has 1K series resistor
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB4 // FT
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#define USE_FLASHTOOLS
|
||||
#define USE_FLASH_M25P16
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0 // RX7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RX8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
#define WS2811_DMA_STREAM DMA1_Channel3
|
||||
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH3_HANDLER
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PA6 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define USE_FLASHFS
|
||||
#define USE_FLASH_M25P16
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
// USART2, PA3
|
||||
#define BIND_PIN PA3
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
// #define RANGEFINDER_HCSR04_TRIGGER_PIN PA2 // PWM6 (PA2) - only 3.3v ( add a 1K Ohms resistor )
|
||||
// #define RANGEFINDER_HCSR04_ECHO_PIN PB1 // PWM7 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
#define LED_STRIP
|
||||
#define LED_STRIP_TIMER TIM5
|
||||
|
||||
// #define RANGEFINDER
|
||||
// #define USE_RANGEFINDER
|
||||
// #define USE_RANGEFINDER_HCSR04
|
||||
// #define RANGEFINDER_HCSR04_TRIGGER_PIN PC2
|
||||
// #define RANGEFINDER_HCSR04_ECHO_PIN PC3
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
#define WS2811_DMA_STREAM DMA1_Channel2
|
||||
#define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#define USE_MAG_HMC5883 // External
|
||||
#define MAG_AK8963_ALIGN CW270_DEG_FLIP
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
#define SPEKTRUM_BIND
|
||||
#define BIND_PIN PA3 // USART2, PA3
|
||||
|
||||
#define RANGEFINDER
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue