Skip to content

Commit c89ee9e

Browse files
committed
missing guard checks introduced
1 parent d067850 commit c89ee9e

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

libraries/AP_GPS/AP_GPS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ class AP_GPS
704704
// they should be configuring the GPS to run at
705705
uint16_t get_rate_ms(uint8_t instance) const;
706706

707+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
707708
// general errors in the GNSS system
708709
uint32_t get_system_errors(uint8_t instance) const {
709710
return state[instance].system_errors;
@@ -726,6 +727,7 @@ class AP_GPS
726727
uint8_t get_spoofing_state(uint8_t instance) const {
727728
return state[instance].spoofing_state;
728729
}
730+
#endif // AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
729731

730732
struct GPS_timing {
731733
// the time we got our last fix in system milliseconds

libraries/AP_GPS/AP_GPS_SBF.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ AP_GPS_SBF::process_message(void)
596596
(unsigned int)(ExtError & EXT_ERROR_MASK), (unsigned int)(temp.ExtError & EXT_ERROR_MASK));
597597
}
598598
ExtError = temp.ExtError;
599-
599+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
600600
state.system_errors = static_cast<uint32_t>(AP_GPS::Errors::GPS_SYSTEM_ERROR_NONE);
601601

602602
if (ExtError & DIFFCORRERROR) {
@@ -608,15 +608,15 @@ AP_GPS_SBF::process_message(void)
608608
state.system_errors |= static_cast<uint32_t>(map_entry.ap_error_enum);
609609
}
610610
}
611-
611+
#endif // AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
612612
break;
613613
}
614614

615615
case RFStatus:
616616
{
617617
const msg4092 &temp = sbf_msg.data.msg4092u;
618618
check_new_itow(temp.TOW, sbf_msg.length);
619-
#if HAL_GCS_ENABLED
619+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
620620
if (temp.Flags==0) {
621621
state.spoofing_state = static_cast<uint8_t>(AP_GPS::Spoofing::OK);
622622
}
@@ -653,14 +653,15 @@ AP_GPS_SBF::process_message(void)
653653
}
654654
p += temp.SBLength;
655655
}
656-
#endif
656+
#endif // AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
657657
break;
658658
}
659659

660660
case GALAuthStatus:
661661
{
662662
const msg4245 &temp = sbf_msg.data.msg4245u;
663663
check_new_itow(temp.TOW, sbf_msg.length);
664+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
664665
switch (temp.OSNMAStatus & (uint16_t)0b111) {
665666
case 0:
666667
state.authentication_state = static_cast<uint8_t>(AP_GPS::Authentication::DISABLED);
@@ -681,6 +682,7 @@ AP_GPS_SBF::process_message(void)
681682
state.authentication_state = static_cast<uint8_t>(AP_GPS::Authentication::UNKNOWN);
682683
break;
683684
}
685+
#endif // AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
684686
break;
685687
}
686688

libraries/GCS_MAVLink/GCS_Common.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,9 @@ ap_message GCS_MAVLINK::mavlink_id_to_ap_message_id(const uint32_t mavlink_id) c
10551055
{ MAVLINK_MSG_ID_MISSION_CURRENT, MSG_CURRENT_WAYPOINT},
10561056
{ MAVLINK_MSG_ID_SERVO_OUTPUT_RAW, MSG_SERVO_OUTPUT_RAW},
10571057
{ MAVLINK_MSG_ID_RC_CHANNELS, MSG_RC_CHANNELS},
1058+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
10581059
{ MAVLINK_MSG_ID_GNSS_INTEGRITY, MSG_GNSS_INTEGRITY},
1060+
#endif
10591061
#if AP_MAVLINK_MSG_RC_CHANNELS_RAW_ENABLED
10601062
{ MAVLINK_MSG_ID_RC_CHANNELS_RAW, MSG_RC_CHANNELS_RAW},
10611063
#endif
@@ -6498,10 +6500,12 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
64986500
AP::gps().send_mavlink_gps_rtk(chan, 1);
64996501
break;
65006502
#endif // AP_GPS_GPS2_RTK_SENDING_ENABLED
6503+
#if AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
65016504
case MSG_GNSS_INTEGRITY:
65026505
CHECK_PAYLOAD_SIZE(GNSS_INTEGRITY);
65036506
AP::gps().send_mavlink_gnss_integrity(chan, 0);
65046507
break;
6508+
#endif // AP_MAVLINK_MSG_GNSS_INTEGRITY_ENABLED
65056509
#if AP_AHRS_ENABLED
65066510
case MSG_LOCAL_POSITION:
65076511
CHECK_PAYLOAD_SIZE(LOCAL_POSITION_NED);

0 commit comments

Comments
 (0)