Merge pull request #6260 from etracer65/undef_feature_cleanup

Fix various compiler warnings for combinations of undefined USE_ features
This commit is contained in:
Michael Keller 2018-07-09 22:51:43 +12:00 committed by GitHub
commit b2e56de9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 2 deletions

View File

@ -558,7 +558,9 @@ bool isAirmodeActivated()
bool processRx(timeUs_t currentTimeUs)
{
static bool armedBeeperOn = false;
#ifdef USE_TELEMETRY
static bool sharedPortTelemetryEnabled = false;
#endif
if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) {
return false;

View File

@ -169,10 +169,10 @@ STATIC_UNIT_TESTED void crsfDataReceive(uint16_t c, void *data)
break;
}
#endif
#if defined(USE_CRSF_CMS_TELEMETRY)
case CRSF_FRAMETYPE_DEVICE_PING:
crsfScheduleDeviceInfoResponse();
break;
#if defined(USE_CRSF_CMS_TELEMETRY)
case CRSF_FRAMETYPE_DISPLAYPORT_CMD: {
uint8_t *frameStart = (uint8_t *)&crsfFrame.frame.payload + CRSF_FRAME_ORIGIN_DEST_SIZE;
crsfProcessDisplayPortCmd(frameStart);

View File

@ -25,7 +25,7 @@
#include "platform.h"
#if defined(USE_SERIAL_RX)
#if defined(USE_SERIALRX_FPORT)
#include "build/debug.h"
@ -114,7 +114,9 @@ typedef struct fportFrame_s {
fportData_t data;
} fportFrame_t;
#ifdef USE_TELEMETRY_SMARTPORT
static const smartPortPayload_t emptySmartPortFrame = { .frameId = 0, .valueId = 0, .data = 0 };
#endif
#define FPORT_REQUEST_FRAME_LENGTH sizeof(fportFrame_t)
#define FPORT_RESPONSE_FRAME_LENGTH (sizeof(uint8_t) + sizeof(smartPortPayload_t))
@ -144,7 +146,9 @@ static smartPortPayload_t *mspPayload = NULL;
static timeUs_t lastRcFrameReceivedMs = 0;
static serialPort_t *fportPort;
#ifdef USE_TELEMETRY_SMARTPORT
static bool telemetryEnabled = false;
#endif
static void reportFrameError(uint8_t errorReason) {
static volatile uint16_t frameErrors = 0;
@ -248,7 +252,9 @@ static bool checkChecksum(uint8_t *data, uint8_t length)
static uint8_t fportFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
{
#ifdef USE_TELEMETRY_SMARTPORT
static smartPortPayload_t payloadBuffer;
#endif
static bool hasTelemetryRequest = false;
uint8_t result = RX_FRAME_PENDING;

View File

@ -56,6 +56,45 @@
#endif
#endif
#if !defined(USE_SERIAL_RX)
#undef USE_SERIALRX_CRSF
#undef USE_SERIALRX_IBUS
#undef USE_SERIALRX_JETIEXBUS
#undef USE_SERIALRX_SBUS
#undef USE_SERIALRX_SPEKTRUM
#undef USE_SERIALRX_SUMD
#undef USE_SERIALRX_SUMH
#undef USE_SERIALRX_XBUS
#undef USE_SERIALRX_FPORT
#endif
#if !defined(USE_SERIALRX_CRSF)
#undef USE_TELEMETRY_CRSF
#endif
#if !defined(USE_SERIALRX_SPEKTRUM)
#undef USE_TELEMETRY_JETIEXBUS
#endif
#if !defined(USE_SERIALRX_JETIEXBUS)
#undef USE_TELEMETRY_SRXL
#endif
#if !defined(USE_TELEMETRY)
#undef USE_CRSF_CMS_TELEMETRY
#undef USE_TELEMETRY_CRSF
#undef USE_TELEMETRY_FRSKY_HUB
#undef USE_TELEMETRY_HOTT
#undef USE_TELEMETRY_IBUS
#undef USE_TELEMETRY_IBUS_EXTENDED
#undef USE_TELEMETRY_JETIEXBUS
#undef USE_TELEMETRY_LTM
#undef USE_TELEMETRY_MAVLINK
#undef USE_TELEMETRY_SMARTPORT
#undef USE_TELEMETRY_SRXL
#undef USE_SERIALRX_FPORT
#endif
#if defined(USE_MSP_OVER_TELEMETRY)
#if !defined(USE_TELEMETRY_SMARTPORT) && !defined(USE_TELEMETRY_CRSF)
#undef USE_MSP_OVER_TELEMETRY

View File

@ -478,6 +478,8 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
uint8_t *frameStart = (uint8_t *)&payload->valueId;
smartPortMspReplyPending = handleMspFrame(frameStart, SMARTPORT_MSP_PAYLOAD_SIZE);
}
#else
UNUSED(payload);
#endif
bool doRun = true;