diff --git a/msg/CMakeLists.txt b/msg/CMakeLists.txt index bae5c67a8872..c6da74a23518 100644 --- a/msg/CMakeLists.txt +++ b/msg/CMakeLists.txt @@ -151,8 +151,8 @@ set(msg_files ObstacleDistance.msg OffboardControlMode.msg OnboardComputerStatus.msg - OpenDroneIdArmStatus.msg - OpenDroneIdBasicId.msg + OpenDroneIdArmStatus.msg + OpenDroneIdBasicId.msg OpenDroneIdOperatorId.msg OpenDroneIdSelfId.msg OpenDroneIdSystem.msg diff --git a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.hpp b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.hpp index 72c46ab98b04..b349475593fd 100644 --- a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.hpp +++ b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.hpp @@ -187,3 +187,4 @@ class HealthAndArmingChecks : public ModuleParams &_vtol_checks, }; }; + diff --git a/src/modules/commander/HealthAndArmingChecks/checks/openDroneIDCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/openDroneIDCheck.cpp index 7f6f5803b40b..2c6a87f8cb7f 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/openDroneIDCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/openDroneIDCheck.cpp @@ -47,15 +47,15 @@ void OpenDroneIDChecks::checkAndReport(const Context &context, Report &reporter) NavModes affected_modes{NavModes::None}; - 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 (_param_com_arm_odid.get() == 2) { + // disallow arming without the Open Drone ID system + affected_modes = NavModes::All; + } - // Check ODID arm status - if (odid_module_arm_status.status == ODID_ARM_FAIL) { + if (_open_drone_id_arm_status_sub.copy(&odid_module_arm_status)) { + + // Check ODID arm status + if (odid_module_arm_status.status == ODID_ARM_FAIL) { /* EVENT * @description * Open Drone ID system reported being unhealthy. @@ -75,22 +75,22 @@ void OpenDroneIDChecks::checkAndReport(const Context &context, Report &reporter) } } else if (!context.status().open_drone_id_system_present) { - /* EVENT - * @description - * Open Drone ID system failed to report. Make sure it is setup and installed properly. - * - * - * This check can be configured via COM_ARM_ODID parameter. - * - */ - 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"); - - if (reporter.mavlink_log_pub()) { - mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID system missing"); - } + /* EVENT + * @description + * Open Drone ID system failed to report. Make sure it is setup and installed properly. + * + * + * This check can be configured via COM_ARM_ODID parameter. + * + */ + 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"); + if (reporter.mavlink_log_pub()) { + mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Open Drone ID system missing"); } + } + } diff --git a/src/modules/mavlink/streams/OPEN_DRONE_ID_ARM_STATUS.hpp b/src/modules/mavlink/streams/OPEN_DRONE_ID_ARM_STATUS.hpp index a7b6a7f95af9..0ec8aeb6e7a8 100644 --- a/src/modules/mavlink/streams/OPEN_DRONE_ID_ARM_STATUS.hpp +++ b/src/modules/mavlink/streams/OPEN_DRONE_ID_ARM_STATUS.hpp @@ -79,11 +79,13 @@ class MavlinkStreamOpenDroneIdArmStatus : public MavlinkStream mavlink_open_drone_id_arm_status_t msg{}; msg.status = drone_id_arm.status; + for (uint8_t i = 0; i < sizeof(drone_id_arm.error); ++i) { msg.error[i] = drone_id_arm.error[i]; } + mavlink_msg_open_drone_id_arm_status_send_struct(_mavlink->get_channel(), &msg);