AP_Mount: allow for compilation without AP_RTC_ENABLED

This commit is contained in:
Peter Barker 2023-10-05 18:40:34 +11:00 committed by Andrew Tridgell
parent 7f90de0973
commit 48b10a3105
2 changed files with 15 additions and 0 deletions

View File

@ -668,6 +668,7 @@ bool AP_Mount_Viewpro::send_m_ahrs()
return false;
}
#if AP_RTC_ENABLED
// get date and time
uint16_t year, ms;
uint8_t month, day, hour, min, sec;
@ -676,6 +677,10 @@ bool AP_Mount_Viewpro::send_m_ahrs()
}
uint16_t date = ((year-2000) & 0x7f) | (((month+1) & 0x0F) << 7) | ((day & 0x1F) << 11);
uint64_t second_hundredths = (((hour * 60 * 60) + (min * 60) + sec) * 100) + (ms * 0.1);
#else
const uint16_t date = 0;
const uint64_t second_hundredths = 0;
#endif
// get vehicle velocity in m/s in NED Frame
Vector3f vel_NED;

View File

@ -502,9 +502,14 @@ void AP_Mount_Xacti::handle_gnss_status_req(AP_DroneCAN* ap_dronecan, const Cana
// get date and time
uint16_t year, ms;
uint8_t month, day, hour, min, sec;
#if AP_RTC_ENABLED
if (!AP::rtc().get_date_and_time_utc(year, month, day, hour, min, sec, ms)) {
year = month = day = hour = min = sec = 0;
}
#else
year = month = day = hour = min = sec = 0;
(void)ms;
#endif
// send xacti specific gnss status message
com_xacti_GnssStatus xacti_gnss_status_msg {};
@ -938,9 +943,14 @@ bool AP_Mount_Xacti::set_datetime(uint32_t now_ms)
// get date and time
uint16_t year, ms;
uint8_t month, day, hour, min, sec;
#if AP_RTC_ENABLED
if (!AP::rtc().get_date_and_time_utc(year, month, day, hour, min, sec, ms)) {
return false;
}
#else
(void)ms;
return false;
#endif
// date time is of the format YYYYMMDDHHMMSS (14 bytes)
// convert month from 0~11 to 1~12 range