diff --git a/libraries/AP_ExternalAHRS/AP_ExternalAHRS_LORD.cpp b/libraries/AP_ExternalAHRS/AP_ExternalAHRS_LORD.cpp index 7ccdce7db5..33c2fe864b 100644 --- a/libraries/AP_ExternalAHRS/AP_ExternalAHRS_LORD.cpp +++ b/libraries/AP_ExternalAHRS/AP_ExternalAHRS_LORD.cpp @@ -262,12 +262,14 @@ void AP_ExternalAHRS_LORD::post_imu() const AP::ins().handle_external(ins); } +#if AP_COMPASS_EXTERNALAHRS_ENABLED { AP_ExternalAHRS::mag_data_message_t mag { field: imu_data.mag }; AP::compass().handle_external(mag); } +#endif #if AP_BARO_EXTERNALAHRS_ENABLED { diff --git a/libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.cpp b/libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.cpp index a273372f99..74cd286afc 100644 --- a/libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.cpp +++ b/libraries/AP_ExternalAHRS/AP_ExternalAHRS_VectorNav.cpp @@ -486,6 +486,7 @@ void AP_ExternalAHRS_VectorNav::process_packet1(const uint8_t *b) } #endif +#if AP_COMPASS_EXTERNALAHRS_ENABLED { AP_ExternalAHRS::mag_data_message_t mag; mag.field = Vector3f{pkt1.mag[0], pkt1.mag[1], pkt1.mag[2]}; @@ -493,6 +494,7 @@ void AP_ExternalAHRS_VectorNav::process_packet1(const uint8_t *b) AP::compass().handle_external(mag); } +#endif { AP_ExternalAHRS::ins_data_message_t ins; @@ -617,6 +619,7 @@ void AP_ExternalAHRS_VectorNav::process_packet_VN_100(const uint8_t *b) } #endif +#if AP_COMPASS_EXTERNALAHRS_ENABLED { AP_ExternalAHRS::mag_data_message_t mag; if (use_uncomp) { @@ -628,6 +631,7 @@ void AP_ExternalAHRS_VectorNav::process_packet_VN_100(const uint8_t *b) AP::compass().handle_external(mag); } +#endif { AP_ExternalAHRS::ins_data_message_t ins;