From a88e34b21b07f70123926fcb5c505d6afdf99807 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 24 Dec 2018 18:54:34 +0100 Subject: style/quality only No functional changes. - add `override' everywhere where missing - almost pass clang's `-Wweak-vtables' - avoid some float/double conversions - remove unused private members - make signedness conversions explicit - put stuff in right namespaces to aid analysis --- proto-ft/ftnoir_protocol_ft.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'proto-ft') diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 314bb451..874f83da 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -23,8 +23,6 @@ freetrack::~freetrack() static_assert(sizeof(LONG) == sizeof(std::int32_t)); static_assert(sizeof(LONG) == 4u); -static constexpr inline float d2r = float(M_PI/180); - cc_noinline void store(float volatile& place, const float value) { union @@ -55,15 +53,17 @@ static std::int32_t load(std::int32_t volatile& place) void freetrack::pose(const double* headpose) { - const float yaw = -headpose[Yaw] * d2r; - const float roll = headpose[Roll] * d2r; + constexpr double d2r = M_PI/180; + + const float yaw = float(-headpose[Yaw] * d2r); + const float roll = float(headpose[Roll] * d2r); const float tx = float(headpose[TX] * 10); const float ty = float(headpose[TY] * 10); const float tz = float(headpose[TZ] * 10); // HACK: Falcon BMS makes a "bump" if pitch is over the value -sh 20170615 const bool is_crossing_90 = std::fabs(headpose[Pitch] - 90) < .15; - const float pitch = -d2r * (is_crossing_90 ? 89.86 : headpose[Pitch]); + const float pitch = float(-d2r * (is_crossing_90 ? 89.86 : headpose[Pitch])); FTHeap* const ft = pMemData; FTData* const data = &ft->data; -- cgit v1.2.3