GCS_MAVLink: add AP_MAVLINK_BATTERY2_ENABLED define

on by default but can be turned off in next stable
This commit is contained in:
Peter Barker 2022-10-15 11:50:49 +11:00 committed by Andrew Tridgell
parent ae1bddfb00
commit f75f68c2f1
3 changed files with 13 additions and 0 deletions

View File

@ -289,7 +289,9 @@ public:
void send_simstate() const;
void send_sim_state() const;
void send_ahrs();
#if AP_MAVLINK_BATTERY2_ENABLED
void send_battery2();
#endif
#if AP_OPTICALFLOW_ENABLED
void send_opticalflow();
#endif

View File

@ -933,7 +933,9 @@ ap_message GCS_MAVLINK::mavlink_id_to_ap_message_id(const uint32_t mavlink_id) c
{ MAVLINK_MSG_ID_DISTANCE_SENSOR, MSG_DISTANCE_SENSOR},
// request also does report:
{ MAVLINK_MSG_ID_TERRAIN_REQUEST, MSG_TERRAIN},
#if AP_MAVLINK_BATTERY2_ENABLED
{ MAVLINK_MSG_ID_BATTERY2, MSG_BATTERY2},
#endif
{ MAVLINK_MSG_ID_CAMERA_FEEDBACK, MSG_CAMERA_FEEDBACK},
#if HAL_MOUNT_ENABLED
{ MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, MSG_GIMBAL_DEVICE_ATTITUDE_STATUS},
@ -2325,6 +2327,7 @@ void GCS::setup_uarts()
#endif
}
#if AP_MAVLINK_BATTERY2_ENABLED
// report battery2 state
void GCS_MAVLINK::send_battery2()
{
@ -2342,6 +2345,7 @@ void GCS_MAVLINK::send_battery2()
}
#endif
}
#endif // AP_MAVLINK_BATTERY2_ENABLED
/*
handle a SET_MODE MAVLink message
@ -5468,10 +5472,12 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
send_battery_status();
break;
#if AP_MAVLINK_BATTERY2_ENABLED
case MSG_BATTERY2:
CHECK_PAYLOAD_SIZE(BATTERY2);
send_battery2();
break;
#endif
case MSG_EKF_STATUS_REPORT:
CHECK_PAYLOAD_SIZE(EKF_STATUS_REPORT);

View File

@ -5,3 +5,8 @@
#ifndef HAL_GCS_ENABLED
#define HAL_GCS_ENABLED 1
#endif
// BATTERY2 is slated to be removed:
#ifndef AP_MAVLINK_BATTERY2_ENABLED
#define AP_MAVLINK_BATTERY2_ENABLED 1
#endif