diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-02-12 19:32:39 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-02-17 16:14:03 -0600 |
| commit | 70ac9ad2e6faf120c8ef4859141675c33e5f33c7 (patch) | |
| tree | 5240c33c48b2eb935afdc7ada04c31738ee80426 /Source/Core/InputCommon/ControllerInterface | |
| parent | 58448d74c541d8081bafff4d35940281db88c610 (diff) | |
InputCommon: Remove Wii Remote real-time calibration of M+ in favor of functionality provided by ControllerEmu.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp | 41 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h | 6 |
2 files changed, 1 insertions, 46 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp index c5d756fb15..34a169aa83 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.cpp @@ -1323,46 +1323,7 @@ void Device::MotionPlusState::ProcessData(const WiimoteEmu::MotionPlus::DataForm if (!calibration.has_value()) return; - // Unfortunately M+ calibration zero values are very poor. - // We calibrate when we receive a few seconds of stable data. - const auto unadjusted_gyro_data = data.GetData().GetAngularVelocity(*calibration); - - // Use zero-data calibration until acquired. - const auto adjusted_gyro_data = - unadjusted_gyro_data - m_dynamic_calibration.value_or(Common::Vec3{}); - - // We want quick calibration when remote is set down but not when held in the hand. - // This magic value seems to work well enough. - static constexpr auto UNSTABLE_ROTATION = float(MathUtil::TAU / 120); - - const bool is_stable = (adjusted_gyro_data - gyro_data).Length() < UNSTABLE_ROTATION; - - gyro_data = adjusted_gyro_data; - - // If we've yet to achieve calibration acquire one more quickly. - // This lessens the extreme drift on initial M+ activation. - const auto required_stable_frames = m_dynamic_calibration.has_value() ? 100u : 5u; - - if (is_stable) - { - if (++m_new_calibration_frames < required_stable_frames) - { - m_new_dynamic_calibration += unadjusted_gyro_data; - } - else - { - m_dynamic_calibration = m_new_dynamic_calibration / m_new_calibration_frames; - m_new_dynamic_calibration = {}; - m_new_calibration_frames = 0; - - DEBUG_LOG(WIIMOTE, "WiiRemote: M+ applied dynamic calibration."); - } - } - else - { - m_new_dynamic_calibration = {}; - m_new_calibration_frames = 0; - } + gyro_data = data.GetData().GetAngularVelocity(*calibration); } bool Device::IsWaitingForMotionPlus() const diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h index e70ad0f293..75296c65b1 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/Wiimote.h @@ -64,12 +64,6 @@ private: Common::Vec3 gyro_data = {}; std::optional<WiimoteEmu::MotionPlus::CalibrationBlocks> calibration; - - private: - // Used to perform realtime calibration. - std::optional<Common::Vec3> m_dynamic_calibration = {}; - Common::Vec3 m_new_dynamic_calibration = {}; - u32 m_new_calibration_frames = 0; }; struct NunchukState |
