From a769d43b90adf85bc3adce8d8bc20dec36a2acd4 Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Sun, 1 Jul 2018 20:21:00 -0400 Subject: [PATCH] Fix various compiler warnings for combinations of undefined USE_ features --- src/main/fc/fc_core.c | 2 ++ src/main/rx/fport.c | 8 +++++++- src/main/target/common_fc_post.h | 10 ++++++++++ src/main/telemetry/smartport.c | 2 ++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 3b8ae1e548..4fefe18ef2 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -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; diff --git a/src/main/rx/fport.c b/src/main/rx/fport.c index f31624ee68..758865c464 100644 --- a/src/main/rx/fport.c +++ b/src/main/rx/fport.c @@ -25,7 +25,7 @@ #include "platform.h" -#if defined(USE_SERIAL_RX) +#if defined(USE_SERIAL_RX) && 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; diff --git a/src/main/target/common_fc_post.h b/src/main/target/common_fc_post.h index b13f008b13..8f13288363 100644 --- a/src/main/target/common_fc_post.h +++ b/src/main/target/common_fc_post.h @@ -56,6 +56,16 @@ #endif #endif +#if !defined(USE_TELEMETRY) +#undef USE_TELEMETRY_FRSKY_HUB +#undef USE_TELEMETRY_HOTT +#undef USE_TELEMETRY_LTM +#undef USE_TELEMETRY_SMARTPORT +#undef USE_TELEMETRY_CRSF +#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 diff --git a/src/main/telemetry/smartport.c b/src/main/telemetry/smartport.c index 4bfec77501..fc0989f501 100644 --- a/src/main/telemetry/smartport.c +++ b/src/main/telemetry/smartport.c @@ -472,6 +472,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;