diff --git a/libraries/AP_GPS/AP_GPS_SBP.cpp b/libraries/AP_GPS/AP_GPS_SBP.cpp index ae08e4f3f4..3bd80af802 100644 --- a/libraries/AP_GPS/AP_GPS_SBP.cpp +++ b/libraries/AP_GPS/AP_GPS_SBP.cpp @@ -30,7 +30,7 @@ extern const AP_HAL::HAL& hal; #define SBP_DEBUGGING 1 -#define SBP_HW_LOGGING 1 +#define SBP_HW_LOGGING HAL_LOGGING_ENABLED #define SBP_TIMEOUT_HEATBEAT 4000 #define SBP_TIMEOUT_PVT 500 @@ -228,7 +228,9 @@ AP_GPS_SBP::_sbp_process_message() { break; } +#if SBP_HW_LOGGING logging_log_raw_sbp(parser_state.msg_type, parser_state.sender_id, parser_state.msg_len, parser_state.msg_buff); +#endif } bool @@ -292,7 +294,9 @@ AP_GPS_SBP::_attempt_state_update() last_full_update_cpu_ms = now; state.rtk_iar_num_hypotheses = last_iar_num_hypotheses; +#if SBP_HW_LOGGING logging_log_full_update(); +#endif ret = true; } else if (now - last_full_update_cpu_ms > SBP_TIMEOUT_PVT) { diff --git a/libraries/AP_GPS/AP_GPS_SBP2.cpp b/libraries/AP_GPS/AP_GPS_SBP2.cpp index 14ed7695a7..b2bf4f4ca7 100644 --- a/libraries/AP_GPS/AP_GPS_SBP2.cpp +++ b/libraries/AP_GPS/AP_GPS_SBP2.cpp @@ -208,17 +208,21 @@ AP_GPS_SBP2::_sbp_process_message() { case SBP_EXT_EVENT_MSGTYPE: memcpy(&last_event, parser_state.msg_buff, sizeof(struct sbp_ext_event_t)); check_new_itow(last_event.tow, parser_state.msg_len); +#if HAL_LOGGING_ENABLED logging_ext_event(); +#endif break; default: break; } +#if HAL_LOGGING_ENABLED // send all messages we receive to log, even if it's an unsupported message, // so we can do additional post-processing from logs. // The log mask will be used to adjust or suppress logging logging_log_raw_sbp(parser_state.msg_type, parser_state.sender_id, parser_state.msg_len, parser_state.msg_buff); +#endif } int32_t @@ -440,6 +444,7 @@ AP_GPS_SBP2::_detect(struct SBP2_detect_state &state, uint8_t data) return false; } +#if HAL_LOGGING_ENABLED void AP_GPS_SBP2::logging_log_full_update() { @@ -525,4 +530,5 @@ AP_GPS_SBP2::logging_ext_event() { }; AP::logger().WriteBlock(&pkt, sizeof(pkt)); }; +#endif // HAL_LOGGING_ENABLED #endif //AP_GPS_SBP2_ENABLED