forked from Archive/PX4-Autopilot
UTM_GLOBAL_POSITION: prevent uint16 overflow
Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
parent
be56f74c1d
commit
4f1682c3c8
|
@ -101,8 +101,8 @@ private:
|
||||||
msg.lon = global_pos.lon * 1e7;
|
msg.lon = global_pos.lon * 1e7;
|
||||||
msg.alt = global_pos.alt_ellipsoid * 1000.f;
|
msg.alt = global_pos.alt_ellipsoid * 1000.f;
|
||||||
|
|
||||||
msg.h_acc = global_pos.eph * 1000.f;
|
msg.h_acc = math::min(global_pos.eph * 1000.0f, (float)UINT16_MAX);
|
||||||
msg.v_acc = global_pos.epv * 1000.f;
|
msg.v_acc = math::min(global_pos.epv * 1000.0f, (float)UINT16_MAX);
|
||||||
|
|
||||||
msg.flags |= UTM_DATA_AVAIL_FLAGS_POSITION_AVAILABLE;
|
msg.flags |= UTM_DATA_AVAIL_FLAGS_POSITION_AVAILABLE;
|
||||||
msg.flags |= UTM_DATA_AVAIL_FLAGS_ALTITUDE_AVAILABLE;
|
msg.flags |= UTM_DATA_AVAIL_FLAGS_ALTITUDE_AVAILABLE;
|
||||||
|
|
Loading…
Reference in New Issue