Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADS-B: Add a MAVLink in only type #24107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions libraries/AP_ADSB/AP_ADSB.cpp
Expand Up @@ -56,7 +56,7 @@ const AP_Param::GroupInfo AP_ADSB::var_info[] = {
// @Param: TYPE
// @DisplayName: ADSB Type
// @Description: Type of ADS-B hardware for ADSB-in and ADSB-out configuration and operation. If any type is selected then MAVLink based ADSB-in messages will always be enabled
// @Values: 0:Disabled,1:uAvionix-MAVLink,2:Sagetech,3:uAvionix-UCP,4:Sagetech MX Series
// @Values: 0:Disabled,1:uAvionix-MAVLink-InOut,2:Sagetech,3:uAvionix-UCP,4:Sagetech MX Series,5:uAvionix-MAVLink-In
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to change the order of the Type values here if you want the "-In" option to be higher on the drop-down list.

I guess users won't be confused by which way is "In" (or "out")?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Rx" and "RxTx"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADS-B world tends to talk about "ADS-B out" as a sentence, so it seemed slightly clearer to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The industry terminology is "-out" or "-in"

// @User: Standard
// @RebootRequired: True
AP_GROUPINFO_FLAGS("TYPE", 0, AP_ADSB, _type[0], 0, AP_PARAM_FLAG_ENABLE),
Expand Down Expand Up @@ -258,7 +258,8 @@ void AP_ADSB::detect_instance(uint8_t instance)
case Type::None:
return;

case Type::uAvionix_MAVLink:
case Type::uAvionix_MAVLink_In:
case Type::uAvionix_MAVLink_InOut:
#if HAL_ADSB_UAVIONIX_MAVLINK_ENABLED
if (AP_ADSB_uAvionix_MAVLink::detect()) {
_backend[instance] = new AP_ADSB_uAvionix_MAVLink(*this, instance);
Expand Down Expand Up @@ -665,6 +666,13 @@ void AP_ADSB::handle_out_control(const mavlink_uavionix_adsb_out_control_t &pack
*/
void AP_ADSB::handle_transceiver_report(const mavlink_channel_t chan, const mavlink_uavionix_adsb_transceiver_health_report_t &packet)
{
// Don't ingest a transciever report, as it's used to trigger sending out control packets
if (_type[0] == (int8_t)(AP_ADSB::Type::uAvionix_MAVLink_In)) {
return;
}
// we need to refactor the code to use AP_SerialManager and ask the user to tell us which serial port is rx vs tx
static_assert(ADSB_MAX_INSTANCES == 1, "Transceiver control is not correctly handled with more then one receiver");

if (out_state.chan != chan) {
gcs().send_text(MAV_SEVERITY_DEBUG, "ADSB: Found transceiver on channel %d", chan);
}
Expand Down Expand Up @@ -794,7 +802,7 @@ void AP_ADSB::handle_message(const mavlink_channel_t chan, const mavlink_message
break;

case MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CONTROL: {
mavlink_uavionix_adsb_out_control_t packet {};
mavlink_uavionix_adsb_out_control_t packet {};
mavlink_msg_uavionix_adsb_out_control_decode(&msg, &packet);
handle_out_control(packet);
break;
Expand Down
11 changes: 6 additions & 5 deletions libraries/AP_ADSB/AP_ADSB.h
Expand Up @@ -59,11 +59,12 @@ class AP_ADSB {

// ADSB driver types
enum class Type {
None = 0,
uAvionix_MAVLink = 1,
Sagetech = 2,
uAvionix_UCP = 3,
Sagetech_MXS = 4,
None = 0,
uAvionix_MAVLink_InOut = 1,
Sagetech = 2,
uAvionix_UCP = 3,
Sagetech_MXS = 4,
uAvionix_MAVLink_In = 5,
};

struct adsb_vehicle_t {
Expand Down
5 changes: 5 additions & 0 deletions libraries/AP_ADSB/AP_ADSB_uAvionix_MAVLink.cpp
Expand Up @@ -38,6 +38,11 @@ bool AP_ADSB_uAvionix_MAVLink::detect()

void AP_ADSB_uAvionix_MAVLink::update()
{
// if we are an in only instance then we are done here, the work below is all related to sending outputs
if (_frontend.get_type(_instance) != AP_ADSB::Type::uAvionix_MAVLink_InOut) {
return;
}

const uint32_t now = AP_HAL::millis();

// send static configuration data to transceiver, every 5s
Expand Down
Expand Up @@ -6,7 +6,7 @@ BATT_VOLT_MULT 12.02
BATT2_AMP_PERVLT 39.877
BATT2_VOLT_MULT 12.02
# setup ADSB
ADSB_TYPE 1
ADSB_TYPE 5
SERIAL5_BAUD 57
SERIAL5_PROTOCOL 1

Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ChibiOS/hwdef/CubeOrange/defaults.parm
Expand Up @@ -6,7 +6,7 @@ BATT_VOLT_MULT 12.02
BATT2_AMP_PERVLT 39.877
BATT2_VOLT_MULT 12.02
# setup ADSB
ADSB_TYPE 1
ADSB_TYPE 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these can go back to 1

SERIAL5_BAUD 57
SERIAL5_PROTOCOL 1
EK2_PRIMARY 1
Expand Down
Expand Up @@ -6,6 +6,6 @@ BATT_VOLT_MULT 12.02
BATT2_AMP_PERVLT 39.877
BATT2_VOLT_MULT 12.02
# setup ADSB
ADSB_TYPE 1
ADSB_TYPE 5
SERIAL5_BAUD 57
SERIAL5_PROTOCOL 1
Expand Up @@ -2,7 +2,7 @@
SERIAL7_OPTIONS 8

# setup ADSB
ADSB_TYPE 1
ADSB_TYPE 5
SERIAL5_BAUD 57
SERIAL5_PROTOCOL 1
EK2_PRIMARY 1
Expand Down