1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Enforce USE_BARO and USE_MAG

This commit is contained in:
jflyper 2019-04-28 21:55:10 +09:00
parent f00ff09a00
commit 625959aa2f
5 changed files with 24 additions and 5 deletions

View file

@ -1357,8 +1357,12 @@ static bool blackboxWriteSysinfo(void)
BLACKBOX_PRINT_HEADER_LINE("acc_lpf_hz", "%d", (int)(accelerometerConfig()->acc_lpf_hz * 100.0f));
BLACKBOX_PRINT_HEADER_LINE("acc_hardware", "%d", accelerometerConfig()->acc_hardware);
#endif
#ifdef USE_BARO
BLACKBOX_PRINT_HEADER_LINE("baro_hardware", "%d", barometerConfig()->baro_hardware);
#endif
#ifdef USE_MAG
BLACKBOX_PRINT_HEADER_LINE("mag_hardware", "%d", compassConfig()->mag_hardware);
#endif
BLACKBOX_PRINT_HEADER_LINE("gyro_cal_on_first_arm", "%d", armingConfig()->gyro_cal_on_first_arm);
BLACKBOX_PRINT_HEADER_LINE("rc_interpolation", "%d", rxConfig()->rcInterpolation);
BLACKBOX_PRINT_HEADER_LINE("rc_interpolation_interval", "%d", rxConfig()->rcInterpolationInterval);

View file

@ -1501,8 +1501,16 @@ static bool mspProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
#else
sbufWriteU8(dst, 0);
#endif
#ifdef USE_BARO
sbufWriteU8(dst, barometerConfig()->baro_hardware);
#else
sbufWriteU8(dst, 0);
#endif
#ifdef USE_MAG
sbufWriteU8(dst, compassConfig()->mag_hardware);
#else
sbufWriteU8(dst, 0);
#endif
break;
#if defined(USE_VTX_COMMON)
@ -2183,9 +2191,16 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
#else
sbufReadU8(src);
#endif
#if defined(USE_BARO)
barometerConfigMutable()->baro_hardware = sbufReadU8(src);
#else
sbufReadU8(src);
#endif
#if defined(USE_MAG)
compassConfigMutable()->mag_hardware = sbufReadU8(src);
#else
sbufReadU8(src);
#endif
break;
case MSP_RESET_CONF:

View file

@ -24,6 +24,8 @@
#include "platform.h"
#ifdef USE_BARO
#include "common/maths.h"
#include "pg/pg.h"
@ -117,8 +119,6 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
#endif
}
#ifdef USE_BARO
static uint16_t calibratingB = 0; // baro calibration = get new ground pressure value
static int32_t baroPressure = 0;
static int32_t baroTemperature = 0;

View file

@ -96,8 +96,6 @@ void targetConfiguration(void)
#if defined(BREADBOARD)
boardAlignmentMutable()->pitchDegrees = 90; // vertical breakout board
barometerConfigMutable()->baro_hardware = BARO_DEFAULT; // still testing not on V1 or V2 pcb
#else
barometerConfigMutable()->baro_hardware = BARO_NONE;
#endif
compassConfigMutable()->mag_hardware = MAG_NONE;

View file

@ -415,6 +415,7 @@ static void setValue(uint8_t* bufferPtr, uint8_t sensorType, uint8_t length)
value.int16 = (int16_t) constrain(getEstimatedVario(), SHRT_MIN, SHRT_MAX);
break;
#endif
#ifdef USE_BARO
case IBUS_SENSOR_TYPE_ALT:
case IBUS_SENSOR_TYPE_ALT_MAX:
value.int32 = baro.BaroAlt;
@ -422,6 +423,7 @@ static void setValue(uint8_t* bufferPtr, uint8_t sensorType, uint8_t length)
case IBUS_SENSOR_TYPE_PRES:
value.uint32 = baro.baroPressure | (((uint32_t)getTemperature()) << 19);
break;
#endif
#endif //defined(TELEMETRY_IBUS_EXTENDED)
}
for (unsigned i = 0; i < length; i++) {