mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
Changed defines for GYRO/ACC/MAG/BARO/GPS/SONAR/OSD/BLACKBOX/CMS to conform to the USE_ convention.
This commit is contained in:
parent
62c5711ce7
commit
a8d34dabb0
152 changed files with 589 additions and 588 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef BLACKBOX
|
||||
#ifdef USE_BLACKBOX
|
||||
|
||||
#include "blackbox.h"
|
||||
#include "blackbox_encoding.h"
|
||||
|
@ -187,15 +187,15 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = {
|
|||
{"vbatLatest", -1, UNSIGNED, .Ipredict = PREDICT(VBATREF), .Iencode = ENCODING(NEG_14BIT), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_VBAT},
|
||||
{"amperageLatest",-1, UNSIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(UNSIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_AMPERAGE_ADC},
|
||||
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
{"magADC", 0, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_MAG},
|
||||
{"magADC", 1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_MAG},
|
||||
{"magADC", 2, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_MAG},
|
||||
#endif
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
{"BaroAlt", -1, SIGNED, .Ipredict = PREDICT(0), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(TAG8_8SVB), FLIGHT_LOG_FIELD_CONDITION_BARO},
|
||||
#endif
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
{"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},
|
||||
|
@ -226,7 +226,7 @@ static const blackboxDeltaFieldDefinition_t blackboxMainFields[] = {
|
|||
{"servo", 5, UNSIGNED, .Ipredict = PREDICT(1500), .Iencode = ENCODING(SIGNED_VB), .Ppredict = PREDICT(PREVIOUS), .Pencode = ENCODING(SIGNED_VB), CONDITION(TRICOPTER)}
|
||||
};
|
||||
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
// GPS position/vel frame
|
||||
static const blackboxConditionalFieldDefinition_t blackboxGpsGFields[] = {
|
||||
{"time", -1, UNSIGNED, PREDICT(LAST_MAIN_FRAME_TIME), ENCODING(UNSIGNED_VB), CONDITION(NOT_LOGGING_EVERY_FRAME)},
|
||||
|
@ -291,13 +291,13 @@ typedef struct blackboxMainState_s {
|
|||
uint16_t vbatLatest;
|
||||
uint16_t amperageLatest;
|
||||
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
int32_t BaroAlt;
|
||||
#endif
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
int16_t magADC[XYZ_AXIS_COUNT];
|
||||
#endif
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
int32_t sonarRaw;
|
||||
#endif
|
||||
uint16_t rssi;
|
||||
|
@ -412,14 +412,14 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition)
|
|||
return currentPidProfile->pid[condition - FLIGHT_LOG_FIELD_CONDITION_NONZERO_PID_D_0].D != 0;
|
||||
|
||||
case FLIGHT_LOG_FIELD_CONDITION_MAG:
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
return sensors(SENSOR_MAG);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
case FLIGHT_LOG_FIELD_CONDITION_BARO:
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
return sensors(SENSOR_BARO);
|
||||
#else
|
||||
return false;
|
||||
|
@ -432,7 +432,7 @@ static bool testBlackboxConditionUncached(FlightLogFieldCondition condition)
|
|||
return batteryConfig()->currentMeterSource == CURRENT_METER_ADC;
|
||||
|
||||
case FLIGHT_LOG_FIELD_CONDITION_SONAR:
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
return feature(FEATURE_SONAR);
|
||||
#else
|
||||
return false;
|
||||
|
@ -550,19 +550,19 @@ static void writeIntraframe(void)
|
|||
blackboxWriteUnsignedVB(blackboxCurrent->amperageLatest);
|
||||
}
|
||||
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_MAG)) {
|
||||
blackboxWriteSigned16VBArray(blackboxCurrent->magADC, XYZ_AXIS_COUNT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_BARO)) {
|
||||
blackboxWriteSignedVB(blackboxCurrent->BaroAlt);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SONAR)) {
|
||||
blackboxWriteSignedVB(blackboxCurrent->sonarRaw);
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ static void writeInterframe(void)
|
|||
deltas[optionalFieldCount++] = (int32_t) blackboxCurrent->amperageLatest - blackboxLast->amperageLatest;
|
||||
}
|
||||
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_MAG)) {
|
||||
for (int x = 0; x < XYZ_AXIS_COUNT; x++) {
|
||||
deltas[optionalFieldCount++] = blackboxCurrent->magADC[x] - blackboxLast->magADC[x];
|
||||
|
@ -686,13 +686,13 @@ static void writeInterframe(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_BARO)) {
|
||||
deltas[optionalFieldCount++] = blackboxCurrent->BaroAlt - blackboxLast->BaroAlt;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_SONAR)) {
|
||||
deltas[optionalFieldCount++] = blackboxCurrent->sonarRaw - blackboxLast->sonarRaw;
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ bool inMotorTestMode(void) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
static void writeGPSHomeFrame(void)
|
||||
{
|
||||
blackboxWrite('H');
|
||||
|
@ -990,7 +990,7 @@ static void loadMainState(timeUs_t currentTimeUs)
|
|||
blackboxCurrent->axisPID_D[i] = axisPID_D[i];
|
||||
blackboxCurrent->gyroADC[i] = lrintf(gyro.gyroADCf[i]);
|
||||
blackboxCurrent->accSmooth[i] = acc.accSmooth[i];
|
||||
#ifdef MAG
|
||||
#ifdef USE_MAG
|
||||
blackboxCurrent->magADC[i] = mag.magADC[i];
|
||||
#endif
|
||||
}
|
||||
|
@ -1011,11 +1011,11 @@ static void loadMainState(timeUs_t currentTimeUs)
|
|||
blackboxCurrent->vbatLatest = getBatteryVoltageLatest();
|
||||
blackboxCurrent->amperageLatest = getAmperageLatest();
|
||||
|
||||
#ifdef BARO
|
||||
#ifdef USE_BARO
|
||||
blackboxCurrent->BaroAlt = baro.BaroAlt;
|
||||
#endif
|
||||
|
||||
#ifdef SONAR
|
||||
#ifdef USE_SONAR
|
||||
// Store the raw sonar value without applying tilt correction
|
||||
blackboxCurrent->sonarRaw = sonarRead();
|
||||
#endif
|
||||
|
@ -1387,7 +1387,7 @@ STATIC_UNIT_TESTED bool blackboxShouldLogIFrame(void)
|
|||
* We write it periodically so that if one Home Frame goes missing, the GPS coordinates can
|
||||
* still be interpreted correctly.
|
||||
*/
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
STATIC_UNIT_TESTED bool blackboxShouldLogGpsHomeFrame(void)
|
||||
{
|
||||
if (GPS_home[0] != gpsHistory.GPS_home[0] || GPS_home[1] != gpsHistory.GPS_home[1]
|
||||
|
@ -1442,7 +1442,7 @@ STATIC_UNIT_TESTED void blackboxLogIteration(timeUs_t currentTimeUs)
|
|||
loadMainState(currentTimeUs);
|
||||
writeInterframe();
|
||||
}
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
if (feature(FEATURE_GPS)) {
|
||||
if (blackboxShouldLogGpsHomeFrame()) {
|
||||
writeGPSHomeFrame();
|
||||
|
@ -1508,7 +1508,7 @@ void blackboxUpdate(timeUs_t currentTimeUs)
|
|||
//On entry of this state, xmitState.headerIndex is 0 and xmitState.u.fieldIndex is -1
|
||||
if (!sendFieldDefinition('I', 'P', blackboxMainFields, blackboxMainFields + 1, ARRAYLEN(blackboxMainFields),
|
||||
&blackboxMainFields[0].condition, &blackboxMainFields[1].condition)) {
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
if (feature(FEATURE_GPS)) {
|
||||
blackboxSetState(BLACKBOX_STATE_SEND_GPS_H_HEADER);
|
||||
} else
|
||||
|
@ -1516,7 +1516,7 @@ void blackboxUpdate(timeUs_t currentTimeUs)
|
|||
blackboxSetState(BLACKBOX_STATE_SEND_SLOW_HEADER);
|
||||
}
|
||||
break;
|
||||
#ifdef GPS
|
||||
#ifdef USE_GPS
|
||||
case BLACKBOX_STATE_SEND_GPS_H_HEADER:
|
||||
blackboxReplenishHeaderBudget();
|
||||
//On entry of this state, xmitState.headerIndex is 0 and xmitState.u.fieldIndex is -1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue