summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2022-01-08 00:06:15 -0800
committerGravatar GitHub2022-01-08 00:06:15 -0800
commit26f4e92c1fa5486f4047990ee7351f18f7fe4f1c (patch)
tree592c31594566b2f933f358b79a7b44380fa2515b
parentMerge pull request #7658 from ameerj/sparse-fixes (diff)
parentcore/hid: Set minimum gyro threshold (diff)
downloadyuzu-26f4e92c1fa5486f4047990ee7351f18f7fe4f1c.tar.gz
yuzu-26f4e92c1fa5486f4047990ee7351f18f7fe4f1c.tar.xz
yuzu-26f4e92c1fa5486f4047990ee7351f18f7fe4f1c.zip
Merge pull request #7680 from german77/accel_mapping
input_common: Allow to only have acceleration motion data
Diffstat (limited to '')
-rw-r--r--src/core/hid/motion_input.cpp1
-rw-r--r--src/input_common/input_engine.cpp12
2 files changed, 11 insertions, 2 deletions
diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp
index a23f192d7..43152492e 100644
--- a/src/core/hid/motion_input.cpp
+++ b/src/core/hid/motion_input.cpp
@@ -10,6 +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.001f);
13} 14}
14 15
15void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { 16void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 9c17ca4f7..b57330e51 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -298,8 +298,16 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot
298 if (!configuring || !mapping_callback.on_data) { 298 if (!configuring || !mapping_callback.on_data) {
299 return; 299 return;
300 } 300 }
301 if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && 301 bool is_active = false;
302 std::abs(value.gyro_z) < 0.6f) { 302 if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f ||
303 std::abs(value.accel_z) > 1.5f) {
304 is_active = true;
305 }
306 if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f ||
307 std::abs(value.gyro_z) > 0.6f) {
308 is_active = true;
309 }
310 if (!is_active) {
303 return; 311 return;
304 } 312 }
305 mapping_callback.on_data(MappingData{ 313 mapping_callback.on_data(MappingData{