diff options
author | german77 <juangerman-13@hotmail.com> | 2022-12-23 15:32:02 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-01-20 01:05:22 +0100 |
commit | e1a3bda4d9881cb99c36b64733b814a3bb437f13 (patch) | |
tree | a9c0d864b023a810f48c129bb8bd6e84afb2ed2b /src/input_common/helpers/joycon_protocol/calibration.cpp | |
parent | core: hid: Fix input regressions (diff) | |
download | yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.gz yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.bz2 yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.lz yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.xz yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.zst yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.zip |
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/calibration.cpp')
-rw-r--r-- | src/input_common/helpers/joycon_protocol/calibration.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/input_common/helpers/joycon_protocol/calibration.cpp b/src/input_common/helpers/joycon_protocol/calibration.cpp index ce1ff7061..cd30ab869 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.cpp +++ b/src/input_common/helpers/joycon_protocol/calibration.cpp @@ -9,7 +9,7 @@ namespace InputCommon::Joycon { CalibrationProtocol::CalibrationProtocol(std::shared_ptr<JoyconHandle> handle) - : JoyconCommonProtocol(handle) {} + : JoyconCommonProtocol(std::move(handle)) {} DriverResult CalibrationProtocol::GetLeftJoyStickCalibration(JoyStickCalibration& calibration) { std::vector<u8> buffer; @@ -136,12 +136,8 @@ DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibratio ring_data_min = current_value - 800; ring_data_default = current_value; } - if (ring_data_max < current_value) { - ring_data_max = current_value; - } - if (ring_data_min > current_value) { - ring_data_min = current_value; - } + ring_data_max = std::max(ring_data_max, current_value); + ring_data_min = std::min(ring_data_min, current_value); calibration = { .default_value = ring_data_default, .max_value = ring_data_max, |