summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2022-01-27 15:44:04 -0800
committerGravatar GitHub2022-01-27 15:44:04 -0800
commit0dec42431fe0511e8277a95fb872c8af67450837 (patch)
treed2e4a7350ca7362b01e5ff6a16fd25f3fbdb279c /src/core
parentMerge pull request #7783 from lioncash/abi-cexpr (diff)
parentinput_common: Add option to configure gyro threshold (diff)
downloadyuzu-0dec42431fe0511e8277a95fb872c8af67450837.tar.gz
yuzu-0dec42431fe0511e8277a95fb872c8af67450837.tar.xz
yuzu-0dec42431fe0511e8277a95fb872c8af67450837.zip
Merge pull request #7770 from german77/motion-threshold
input_common: Add option to configure gyro threshold
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hid/emulated_controller.cpp1
-rw-r--r--src/core/hid/motion_input.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index d12037b11..a7cdf45e6 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -749,6 +749,7 @@ void EmulatedController::SetMotion(const Common::Input::CallbackStatus& callback
749 raw_status.gyro.y.value, 749 raw_status.gyro.y.value,
750 raw_status.gyro.z.value, 750 raw_status.gyro.z.value,
751 }); 751 });
752 emulated.SetGyroThreshold(raw_status.gyro.x.properties.threshold);
752 emulated.UpdateRotation(raw_status.delta_timestamp); 753 emulated.UpdateRotation(raw_status.delta_timestamp);
753 emulated.UpdateOrientation(raw_status.delta_timestamp); 754 emulated.UpdateOrientation(raw_status.delta_timestamp);
754 force_update_motion = raw_status.force_update; 755 force_update_motion = raw_status.force_update;
diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp
index 6e126be19..05042fd99 100644
--- a/src/core/hid/motion_input.cpp
+++ b/src/core/hid/motion_input.cpp
@@ -10,7 +10,7 @@ namespace Core::HID {
10MotionInput::MotionInput() { 10MotionInput::MotionInput() {
11 // Initialize PID constants with default values 11 // Initialize PID constants with default values
12 SetPID(0.3f, 0.005f, 0.0f); 12 SetPID(0.3f, 0.005f, 0.0f);
13 SetGyroThreshold(0.00005f); 13 SetGyroThreshold(0.007f);
14} 14}
15 15
16void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { 16void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
@@ -31,7 +31,7 @@ void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) {
31 gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); 31 gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f);
32 } 32 }
33 33
34 if (gyro.Length2() < gyro_threshold) { 34 if (gyro.Length() < gyro_threshold) {
35 gyro = {}; 35 gyro = {};
36 } else { 36 } else {
37 only_accelerometer = false; 37 only_accelerometer = false;