From d77105b3b17f575f5e7988c34986ec76a67b2cfc Mon Sep 17 00:00:00 2001 From: Joshua Henderson Date: Thu, 6 Jan 2022 17:53:42 -0500 Subject: [PATCH] SITL: Gimbal make some printfs #if GIMBAL_DEBUG --- libraries/SITL/SIM_Gimbal.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/SITL/SIM_Gimbal.cpp b/libraries/SITL/SIM_Gimbal.cpp index 445a4214ef..8468d7616e 100644 --- a/libraries/SITL/SIM_Gimbal.cpp +++ b/libraries/SITL/SIM_Gimbal.cpp @@ -28,6 +28,14 @@ extern const AP_HAL::HAL& hal; +#define GIMBAL_DEBUG 0 + +#if GIMBAL_DEBUG +#define debug(fmt, args...) do { printf("GIMBAL: " fmt, ##args); } while(0) +#else +#define debug(fmt, args...) do { } while(0) +#endif + namespace SITL { Gimbal::Gimbal(const struct sitl_fdm &_fdm) : @@ -287,7 +295,7 @@ void Gimbal::send_report(void) case MAVLINK_MSG_ID_HEARTBEAT: { mavlink_heartbeat_t pkt; mavlink_msg_heartbeat_decode(&msg, &pkt); - printf("Gimbal: got HB type=%u autopilot=%u base_mode=0x%x\n", pkt.type, pkt.autopilot, pkt.base_mode); + debug("got HB type=%u autopilot=%u base_mode=0x%x\n", pkt.type, pkt.autopilot, pkt.base_mode); if (!seen_heartbeat) { seen_heartbeat = true; vehicle_component_id = msg.compid; @@ -336,7 +344,7 @@ void Gimbal::send_report(void) break; } default: - printf("Gimbal got unexpected msg %u\n", msg.msgid); + debug("got unexpected msg %u\n", msg.msgid); break; } }