From 739a81055f8f33ab0987ee730370a0535a1bdf05 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Tue, 21 Feb 2023 21:47:47 -0600 Subject: core: hid: Restore motion state on refresh and clamp motion values --- src/core/hid/motion_input.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/core/hid/motion_input.h') diff --git a/src/core/hid/motion_input.h b/src/core/hid/motion_input.h index 9180bb9aa..e2c1bbf95 100644 --- a/src/core/hid/motion_input.h +++ b/src/core/hid/motion_input.h @@ -20,6 +20,9 @@ public: static constexpr float IsAtRestStandard = 0.01f; static constexpr float IsAtRestThight = 0.005f; + static constexpr float GyroMaxValue = 5.0f; + static constexpr float AccelMaxValue = 7.0f; + explicit MotionInput(); MotionInput(const MotionInput&) = default; @@ -40,6 +43,7 @@ public: void EnableReset(bool reset); void ResetRotations(); + void ResetQuaternion(); void UpdateRotation(u64 elapsed_time); void UpdateOrientation(u64 elapsed_time); @@ -69,7 +73,7 @@ private: Common::Vec3f derivative_error; // Quaternion containing the device orientation - Common::Quaternion quat{{0.0f, 0.0f, -1.0f}, 0.0f}; + Common::Quaternion quat; // Number of full rotations in each axis Common::Vec3f rotations; -- cgit v1.2.3