mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-30 20:48:33 -04:00
AP_HAL_SITL: setup for DroneCAN driver test build
This commit is contained in:
parent
50a760d8a5
commit
b65c74940d
@ -86,7 +86,9 @@ void SITL_State::_sitl_setup()
|
||||
sitl_model->set_precland(&_sitl->precland_sim);
|
||||
_sitl->i2c_sim.init();
|
||||
sitl_model->set_i2c(&_sitl->i2c_sim);
|
||||
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
sitl_model->set_dronecan_device(&_sitl->dronecan_sim);
|
||||
#endif
|
||||
if (_use_fg_view) {
|
||||
fg_socket.connect(_fg_address, _fg_view_port);
|
||||
}
|
||||
|
@ -196,12 +196,20 @@ uint64_t millis64()
|
||||
|
||||
uint32_t native_micros()
|
||||
{
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
return micros();
|
||||
#else
|
||||
return native_micros64() & 0xFFFFFFFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t native_millis()
|
||||
{
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
return millis();
|
||||
#else
|
||||
return native_millis64() & 0xFFFFFFFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -209,28 +217,40 @@ uint32_t native_millis()
|
||||
*/
|
||||
uint16_t native_millis16()
|
||||
{
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
return millis16();
|
||||
#else
|
||||
return native_millis64() & 0xFFFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
uint64_t native_micros64()
|
||||
{
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
return micros64();
|
||||
#else
|
||||
struct timeval tp;
|
||||
gettimeofday(&tp, nullptr);
|
||||
uint64_t ret = 1.0e6 * ((tp.tv_sec + (tp.tv_usec * 1.0e-6)) -
|
||||
(state.start_time.tv_sec +
|
||||
(state.start_time.tv_usec * 1.0e-6)));
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t native_millis64()
|
||||
{
|
||||
#if AP_TEST_DRONECAN_DRIVERS
|
||||
return millis64();
|
||||
#else
|
||||
struct timeval tp;
|
||||
gettimeofday(&tp, nullptr);
|
||||
uint64_t ret = 1.0e3*((tp.tv_sec + (tp.tv_usec*1.0e-6)) -
|
||||
(state.start_time.tv_sec +
|
||||
(state.start_time.tv_usec*1.0e-6)));
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user