Skip to content

Commit

Permalink
fix to missing remote ID module handling
Browse files Browse the repository at this point in the history
Signed-off-by: dirksavage88 <[email protected]>
  • Loading branch information
dirksavage88 authored and julianoes committed May 1, 2024
1 parent 621431d commit be02029
Showing 1 changed file with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2023 PX4 Development Team. All rights reserved.
* Copyright (c) 2024 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -47,51 +47,50 @@ void OpenDroneIDChecks::checkAndReport(const Context &context, Report &reporter)

NavModes affected_modes{NavModes::None};

if (_open_drone_id_arm_status_sub.copy(&odid_module_arm_status)) {

if (_param_com_arm_odid.get() == 2) {
// disallow arming without the Open Drone ID system
affected_modes = NavModes::All;
}

if (_open_drone_id_arm_status_sub.copy(&odid_module_arm_status)) {

if (!context.status().open_drone_id_system_present) {
// Check ODID arm status
if (odid_module_arm_status.status == ODID_ARM_FAIL) {
/* EVENT
* @description
* Open Drone ID system failed to report. Make sure it is setup and installed properly.
* Open Drone ID system reported being unhealthy.
*
* <profile name="dev">
* This check can be configured via <param>COM_ARM_ODID</param> parameter.
* This check can be ignored or set to warning via <param>COM_ARM_ODID</param> parameter.
* </profile>
*/
reporter.armingCheckFailure(affected_modes, health_component_t::open_drone_id,
events::ID("check_open_drone_id_missing"),
events::Log::Error, "Open Drone ID system missing");
events::ID("check_open_drone_id_unhealthy"),
events::Log::Error, "Open Drone ID arm status error");

if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID system missing");
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID arm status error");
}

// Check ODID arm status
}

} else if (odid_module_arm_status.status == ODID_ARM_FAIL) {
} else if (!context.status().open_drone_id_system_present) {
/* EVENT
* @description
* Open Drone ID system reported being unhealthy.
* Open Drone ID system failed to report. Make sure it is setup and installed properly.
*
* <profile name="dev">
* This check can be ignored or set to warning via <param>COM_ARM_ODID</param> parameter.
* This check can be configured via <param>COM_ARM_ODID</param> parameter.
* </profile>
*/
reporter.armingCheckFailure(affected_modes, health_component_t::open_drone_id,
events::ID("check_open_drone_id_unhealthy"),
events::Log::Error, "Open Drone ID arm status error");
events::ID("check_open_drone_id_missing"),
events::Log::Error, "Open Drone ID system missing");

if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID arm status error");
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID system missing");
}

}

}

}

0 comments on commit be02029

Please sign in to comment.