Bläddra i källkod

device: Map FrSky RC controller as flight stick instead of gamepad

Reverts f01399bba875929d0f25c460c290f584f0f81608
rdb 4 år sedan
förälder
incheckning
72bf9e7fd1
2 ändrade filer med 6 tillägg och 19 borttagningar
  1. 2 0
      panda/src/device/evdevInputDevice.cxx
  2. 4 19
      panda/src/device/winRawInputDevice.cxx

+ 2 - 0
panda/src/device/evdevInputDevice.cxx

@@ -113,6 +113,8 @@ static const struct DeviceMapping {
   {0x046d, 0xc629, InputDevice::DeviceClass::spatial_mouse, 0},
   // 3Dconnexion Space Mouse Pro
   {0x046d, 0xc62b, InputDevice::DeviceClass::spatial_mouse, 0},
+  // FrSky Simulator
+  {0x0483, 0x5720, InputDevice::DeviceClass::flight_stick, 0},
   {0},
 };
 

+ 4 - 19
panda/src/device/winRawInputDevice.cxx

@@ -38,9 +38,6 @@ enum QuirkBits : int {
 
   // Axes on the right stick are swapped, using x for y and vice versa.
   QB_right_axes_swapped = 64,
-
-  // Using an RC (drone) controller as a gamepad instead of a flight stick
-  QB_rc_controller = 128,
 };
 
 // Some nonstandard gamepads have different button mappings.
@@ -89,7 +86,7 @@ static const struct DeviceMapping {
     {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"}
   },
   // FrSky Simulator
-  {0x0483, 0x5720, InputDevice::DeviceClass::gamepad, QB_rc_controller,
+  {0x0483, 0x5720, InputDevice::DeviceClass::flight_stick, 0,
     {0}
   },
   {0},
@@ -441,11 +438,7 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
         switch (usage) {
           case HID_USAGE_GENERIC_X:
           if (_device_class == DeviceClass::gamepad) {
-            if (quirks & QB_rc_controller) {
-              axis = Axis::right_x;
-            } else {
-              axis = Axis::left_x;
-            }
+            axis = Axis::left_x;
           } else if (_device_class == DeviceClass::flight_stick) {
             axis = Axis::roll;
           } else {
@@ -454,12 +447,8 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
           break;
         case HID_USAGE_GENERIC_Y:
           if (_device_class == DeviceClass::gamepad) {
-            if (quirks & QB_rc_controller) {
-              axis = Axis::right_y;
-            } else {
-              axis = Axis::left_y;
-              swap(cap.LogicalMin, cap.LogicalMax);
-            }
+            axis = Axis::left_y;
+            swap(cap.LogicalMin, cap.LogicalMax);
           } else if (_device_class == DeviceClass::flight_stick) {
             axis = Axis::pitch;
           } else {
@@ -476,8 +465,6 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
               } else {
                 axis = InputDevice::Axis::right_x;
               }
-            } else if (quirks & QB_rc_controller) {
-              axis = InputDevice::Axis::left_y;
             } else if ((quirks & QB_no_analog_triggers) == 0) {
               axis = Axis::left_trigger;
             }
@@ -500,8 +487,6 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
               if ((quirks & QB_no_analog_triggers) == 0) {
                 axis = Axis::left_trigger;
               }
-            } else if (quirks & QB_rc_controller) {
-              axis = Axis::left_x;
             } else {
               axis = Axis::right_x;
             }