Skip to content

Commit

Permalink
Added support for Flysky FS-SM100 RC USB adapter
Browse files Browse the repository at this point in the history
Modified the  axes remapping part of SimJoystick to add support for the Flysky FS-SM100 RC USB adapter
  • Loading branch information
michael-fonder committed Oct 9, 2018
1 parent 4b657ad commit 4742143
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Unreal/Plugins/AirSim/Source/SimJoyStick/SimJoyStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4742143

Please sign in to comment.