2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #7680 from german77/accel_mapping

input_common: Allow to only have acceleration motion data
This commit is contained in:
bunnei 2022-01-08 00:06:15 -08:00 committed by GitHub
commit 26f4e92c1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -10,6 +10,7 @@ namespace Core::HID {
MotionInput::MotionInput() { MotionInput::MotionInput() {
// Initialize PID constants with default values // Initialize PID constants with default values
SetPID(0.3f, 0.005f, 0.0f); SetPID(0.3f, 0.005f, 0.0f);
SetGyroThreshold(0.001f);
} }
void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) { void MotionInput::SetPID(f32 new_kp, f32 new_ki, f32 new_kd) {

View file

@ -298,8 +298,16 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot
if (!configuring || !mapping_callback.on_data) { if (!configuring || !mapping_callback.on_data) {
return; return;
} }
if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && bool is_active = false;
std::abs(value.gyro_z) < 0.6f) { if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f ||
std::abs(value.accel_z) > 1.5f) {
is_active = true;
}
if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f ||
std::abs(value.gyro_z) > 0.6f) {
is_active = true;
}
if (!is_active) {
return; return;
} }
mapping_callback.on_data(MappingData{ mapping_callback.on_data(MappingData{