From 474214364676b6631c01b3ed79d00c83ba5bccf5 Mon Sep 17 00:00:00 2001 From: michael-fonder Date: Tue, 9 Oct 2018 11:35:19 +0200 Subject: [PATCH] Added support for Flysky FS-SM100 RC USB adapter Modified the axes remapping part of SimJoystick to add support for the Flysky FS-SM100 RC USB adapter --- .../AirSim/Source/SimJoyStick/SimJoyStick.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp b/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp index 6b195b325b..54b317a5d4 100644 --- a/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp +++ b/Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp @@ -79,6 +79,18 @@ struct SimJoyStick::impl { throw std::invalid_argument("Unsupported axis_type in getMappedValue"); } } + else if (device_pid_vid == "VID_0401&PID_0401") { //Flysky FS-SM100 RC USB adapter + switch (axis_type) { + case AxisMap::AxisType::LeftX: rc_axis = AxisMap::AxisType::RightY; break; + case AxisMap::AxisType::LeftY: rc_axis = AxisMap::AxisType::LeftX; break; + case AxisMap::AxisType::LeftZ: rc_axis = AxisMap::AxisType::RightX; break; + case AxisMap::AxisType::RightX: rc_axis = AxisMap::AxisType::LeftY; break; + case AxisMap::AxisType::RightY: rc_axis = AxisMap::AxisType::LeftZ; break; + case AxisMap::AxisType::RightZ: rc_axis = AxisMap::AxisType::RightZ; break; + default: + throw std::invalid_argument("Unsupported axis_type in getMappedValue"); + } + } else { //Xbox controllers rc_axis = axis_type; } @@ -115,7 +127,7 @@ struct SimJoyStick::impl { if ( ((device_pid_vid == "" || device_pid_vid == "VID_0483&PID_5710") && (axis_type == AxisMap::AxisType::LeftZ || axis_type == AxisMap::AxisType::RightY)) || - ((device_pid_vid != "" && device_pid_vid != "VID_0483&PID_5710") && + ((device_pid_vid != "" && device_pid_vid != "VID_0483&PID_5710" && device_pid_vid != "VID_0401&PID_0401") && (axis_type == AxisMap::AxisType::LeftY)) ) val = 1 - val;