Skip to content

Mavlink Configuration Defines

Phil Schatzmann edited this page May 7, 2026 · 3 revisions

This document describes the compile-time configuration macros used by ArduinoMavlink.

Current defaults are defined in:

How to override defines

All active defaults are wrapped with #ifndef, so you can override them before including Mavlink.h.

Example approach:

  1. Define your values in your sketch (or a central project header).
  2. Include Mavlink.h afterwards.

If you are using PlatformIO you can define the parameter with the help of the build_flags.

build_flags=-DMAVLINK_CRC_EXTRA=0

Define reference

Define Default Description
MAVLINK_ALIGNED_FIELDS 1 Enables aligned field access in MAVLink message structures for better performance on most targets.
MAVLINK_CRC_EXTRA 1 Enables MAVLink extra CRC byte checks to validate message compatibility and integrity.
MAVLINK_COMMAND_24BIT 1 Enables 24-bit command IDs used by MAVLink 2 command handling.
MAVLINK_VERSION 2 MAVLink protocol major version used by the library.
MAVLINK_PROTOCOL_VERSION 2 Protocol framing version (MAVLink 2).
MAVLINK_COMM_NUM_BUFFERS 1 Number of MAVLink communication channel buffers allocated. Increase only if you use multiple channels simultaneously.
MAVLINK_MAX_PAYLOAD_LEN 255 Maximum payload size for MAVLink v2 packets.
MAVLINK_SYSTEM_ID 255 Default MAVLink system ID for this node. Set to a unique value in your vehicle/network.
MAVLINK_COMPONENT_ID 200 Default MAVLink component ID for this node.
MAVLINK_USE_SIGNING 0 Enables (1) or disables (0) MAVLink packet signing.
MAVLINK_USE_CONVENIENCE_FUNCTIONS disabled (undefined) Optional convenience API helpers. Uncomment/define to enable if needed.
MAVLINK_MAX_LOG_SIZE 120 Maximum log message size used by internal logging helpers.
MAVLINK_USE_ESP_LOGGER true Enables ESP-style logging integration when available.

Notes

  • If MAVLink signing is enabled with MAVLINK_USE_SIGNING=1, keys and signing state must also be configured at runtime.
  • Prefer keeping MAVLINK_VERSION, MAVLINK_PROTOCOL_VERSION, and MAVLINK_MAX_PAYLOAD_LEN at defaults unless you fully control both communication endpoints.
  • Keep MAVLINK_SYSTEM_ID and MAVLINK_COMPONENT_ID unique in multi-vehicle/multi-component environments.

Clone this wiki locally