diff options
| author | 2022-12-20 19:10:42 -0600 | |
|---|---|---|
| committer | 2023-01-19 18:05:21 -0600 | |
| commit | 751d36e7392b0b1637f17988cfc1ef0d7cd95753 (patch) | |
| tree | 8ba772846be04719e41f82ef059ee81491a7c0e9 /src/input_common/helpers/joycon_protocol/calibration.cpp | |
| parent | input_common: Add support for joycon input reports (diff) | |
| download | yuzu-751d36e7392b0b1637f17988cfc1ef0d7cd95753.tar.gz yuzu-751d36e7392b0b1637f17988cfc1ef0d7cd95753.tar.xz yuzu-751d36e7392b0b1637f17988cfc1ef0d7cd95753.zip | |
input_common: Add support for joycon ring controller
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/calibration.cpp')
| -rw-r--r-- | src/input_common/helpers/joycon_protocol/calibration.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/input_common/helpers/joycon_protocol/calibration.cpp b/src/input_common/helpers/joycon_protocol/calibration.cpp index 5c29af545..ce1ff7061 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.cpp +++ b/src/input_common/helpers/joycon_protocol/calibration.cpp | |||
| @@ -128,6 +128,28 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati | |||
| 128 | return result; | 128 | return result; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration, | ||
| 132 | s16 current_value) { | ||
| 133 | // TODO: Get default calibration form ring itself | ||
| 134 | if (ring_data_max == 0 && ring_data_min == 0) { | ||
| 135 | ring_data_max = current_value + 800; | ||
| 136 | ring_data_min = current_value - 800; | ||
| 137 | ring_data_default = current_value; | ||
| 138 | } | ||
| 139 | if (ring_data_max < current_value) { | ||
| 140 | ring_data_max = current_value; | ||
| 141 | } | ||
| 142 | if (ring_data_min > current_value) { | ||
| 143 | ring_data_min = current_value; | ||
| 144 | } | ||
| 145 | calibration = { | ||
| 146 | .default_value = ring_data_default, | ||
| 147 | .max_value = ring_data_max, | ||
| 148 | .min_value = ring_data_min, | ||
| 149 | }; | ||
| 150 | return DriverResult::Success; | ||
| 151 | } | ||
| 152 | |||
| 131 | void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { | 153 | void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { |
| 132 | constexpr u16 DefaultStickCenter{2048}; | 154 | constexpr u16 DefaultStickCenter{2048}; |
| 133 | constexpr u16 DefaultStickRange{1740}; | 155 | constexpr u16 DefaultStickRange{1740}; |