From 83e5cbf93e7a4daeefd770b1b9ebca22f2eafe67 Mon Sep 17 00:00:00 2001
From: Peter Barker <pbarker@barker.dropbear.id.au>
Date: Thu, 28 Sep 2023 08:46:37 +1000
Subject: [PATCH] AP_RCProtocol: disable raw logging if no RC_Channel

We're asking the singleton here for information on whether we should do raw logging.  We may not actually be compiling the RC_Channel library in.
---
 libraries/AP_RCProtocol/AP_RCProtocol_Backend.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_Backend.cpp b/libraries/AP_RCProtocol/AP_RCProtocol_Backend.cpp
index 9575ab22f74757..7c61f5355d3735 100644
--- a/libraries/AP_RCProtocol/AP_RCProtocol_Backend.cpp
+++ b/libraries/AP_RCProtocol/AP_RCProtocol_Backend.cpp
@@ -178,7 +178,8 @@ void AP_RCProtocol_Backend::configure_vtx(uint8_t band, uint8_t channel, uint8_t
  */
 void AP_RCProtocol_Backend::log_data(AP_RCProtocol::rcprotocol_t prot, uint32_t timestamp, const uint8_t *data, uint8_t len) const
 {
-#if HAL_LOGGING_ENABLED
+#if HAL_LOGGING_ENABLED && AP_RC_CHANNEL_ENABLED
+
 #if (CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX)
     if (&rc() == nullptr) { // allow running without RC_Channels if we are doing the examples
         return;
@@ -214,7 +215,7 @@ void AP_RCProtocol_Backend::log_data(AP_RCProtocol::rcprotocol_t prot, uint32_t
                            u32[0], u32[1], u32[2], u32[3], u32[4],
                            u32[5], u32[6], u32[7], u32[8], u32[9]);
     }
-#endif  // HAL_LOGGING_ENABLED
+#endif  // HAL_LOGGING_ENABLED && AP_RC_CHANNEL_ENABLED
 }
 
 #endif  // AP_RCPROTOCOL_ENABLED