MCPcopy Create free account
hub / github.com/PX4/PX4-Autopilot / copy

Method copy

platforms/common/uORB/SubscriptionInterval.cpp:57–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57bool SubscriptionInterval::copy(void *dst)
58{
59 if (_subscription.copy(dst)) {
60 const hrt_abstime now = hrt_absolute_time();
61
62 // make sure we don't set a timestamp before the timer started counting (now - _interval_us would wrap because it's unsigned)
63 if (now > _interval_us) {
64 // shift last update time forward, but don't let it get further behind than the interval
65 _last_update = math::constrain(_last_update + _interval_us, now - _interval_us, now);
66
67 } else {
68 _last_update = now;
69 }
70
71 return true;
72 }
73
74 return false;
75}
76
77} // namespace uORB

Callers 15

update_paramsMethod · 0.45
parameters_updateMethod · 0.45
RunMethod · 0.45
__init__Method · 0.45
time_px4_uorb_directMethod · 0.45
RunMethod · 0.45
RunMethod · 0.45
getActuatorCorrectionMethod · 0.45
updateSetpointMethod · 0.45

Calls 2

hrt_absolute_timeFunction · 0.50
constrainFunction · 0.50

Tested by 6

time_px4_uorb_directMethod · 0.36
_check_paramsMethod · 0.36
RunMethod · 0.36
parameters_updateMethod · 0.36
updateMethod · 0.36