mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Mount: allow for compilation without AP_RTC_ENABLED
This commit is contained in:
parent
7f90de0973
commit
48b10a3105
@ -668,6 +668,7 @@ bool AP_Mount_Viewpro::send_m_ahrs()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if AP_RTC_ENABLED
|
||||||
// get date and time
|
// get date and time
|
||||||
uint16_t year, ms;
|
uint16_t year, ms;
|
||||||
uint8_t month, day, hour, min, sec;
|
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);
|
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);
|
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
|
// get vehicle velocity in m/s in NED Frame
|
||||||
Vector3f vel_NED;
|
Vector3f vel_NED;
|
||||||
|
@ -502,9 +502,14 @@ void AP_Mount_Xacti::handle_gnss_status_req(AP_DroneCAN* ap_dronecan, const Cana
|
|||||||
// get date and time
|
// get date and time
|
||||||
uint16_t year, ms;
|
uint16_t year, ms;
|
||||||
uint8_t month, day, hour, min, sec;
|
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)) {
|
if (!AP::rtc().get_date_and_time_utc(year, month, day, hour, min, sec, ms)) {
|
||||||
year = month = day = hour = min = sec = 0;
|
year = month = day = hour = min = sec = 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
year = month = day = hour = min = sec = 0;
|
||||||
|
(void)ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
// send xacti specific gnss status message
|
// send xacti specific gnss status message
|
||||||
com_xacti_GnssStatus xacti_gnss_status_msg {};
|
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
|
// get date and time
|
||||||
uint16_t year, ms;
|
uint16_t year, ms;
|
||||||
uint8_t month, day, hour, min, sec;
|
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)) {
|
if (!AP::rtc().get_date_and_time_utc(year, month, day, hour, min, sec, ms)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)ms;
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// date time is of the format YYYYMMDDHHMMSS (14 bytes)
|
// date time is of the format YYYYMMDDHHMMSS (14 bytes)
|
||||||
// convert month from 0~11 to 1~12 range
|
// convert month from 0~11 to 1~12 range
|
||||||
|
Loading…
Reference in New Issue
Block a user