ardupilot
ardupilot copied to clipboard
Ardupilot-MAVlink battery monitor
This commit introduces functionality to support battery monitors using the MAVLink protocol. The following changes are included:
- Added conditional compilation for MAVLink support (
#if AP_BATTERY_MAVLINK_ENABLED
). - Defined
AP_BATTERY_MAVLINK_ENABLED
to default toAP_BATTERY_BACKEND_DEFAULT_ENABLED
if not explicitly set. - Implemented
handle_msg(const mavlink_message_t &msg)
inAP_BattMonitor
to iterate through configured instances and pass MAVLink messages to appropriate drivers. - Updated driver instantiation to include MAVLink type (
Type::MAVLink
) when configured (BATTx_MONITOR=30
).
These changes enables the battery monitor to interface with MAVLink-enabled battery devices, enabling the flight controller to receive and process battery status updates via MAVLink messages. The implementation ensures compatibility and functionality when MAVLink battery monitor driver is enabled through configuration (BATTx_MONITOR=30) and tested in SITL.