diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:54:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | a88e34b21b07f70123926fcb5c505d6afdf99807 (patch) | |
tree | 905059194dcc64c7c163b8912947d8173fd4cc91 /proto-ft/ftnoir_protocol_ft.cpp | |
parent | 5bf85412e4eacf92acc936b6e74bce0e2b1055d9 (diff) |
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
Diffstat (limited to 'proto-ft/ftnoir_protocol_ft.cpp')
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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; |