GCS_MAVLink: allow for mavlink bindings only in GCS_MAVLink

this is used by SITL periph to allow for mavlink based simulators
This commit is contained in:
Andrew Tridgell 2023-09-28 09:33:30 +10:00
parent 7aa1f5af22
commit 5f5de52984
2 changed files with 19 additions and 1 deletions

View File

@ -22,7 +22,7 @@ This provides some support code and variables for MAVLink enabled sketches
#include "GCS_config.h"
#if HAL_GCS_ENABLED
#if HAL_MAVLINK_BINDINGS_ENABLED
#include "GCS.h"
#include "GCS_MAVLink.h"
@ -41,6 +41,10 @@ extern const AP_HAL::HAL& hal;
#pragma GCC diagnostic pop
#endif
#endif // HAL_MAVLINK_BINDINGS_ENABLED
#if HAL_GCS_ENABLED
AP_HAL::UARTDriver *mavlink_comm_port[MAVLINK_COMM_NUM_BUFFERS];
bool gcs_alternative_active[MAVLINK_COMM_NUM_BUFFERS];
@ -180,3 +184,13 @@ HAL_Semaphore &comm_chan_lock(mavlink_channel_t chan)
}
#endif // HAL_GCS_ENABLED
#if HAL_MAVLINK_BINDINGS_ENABLED && !HAL_GCS_ENABLED
/*
this allows for SITL bindings for constructing mavlink messages
*/
mavlink_status_t* mavlink_get_channel_status(uint8_t chan)
{
return nullptr;
}
#endif

View File

@ -7,6 +7,10 @@
#define HAL_GCS_ENABLED 1
#endif
#ifndef HAL_MAVLINK_BINDINGS_ENABLED
#define HAL_MAVLINK_BINDINGS_ENABLED HAL_GCS_ENABLED
#endif
// BATTERY2 is slated to be removed:
#ifndef AP_MAVLINK_BATTERY2_ENABLED
#define AP_MAVLINK_BATTERY2_ENABLED 1