summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/joycon_protocol/calibration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/calibration.cpp')
-rw-r--r--src/input_common/helpers/joycon_protocol/calibration.cpp22
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
return result;
}
+DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration,
+ s16 current_value) {
+ // TODO: Get default calibration form ring itself
+ if (ring_data_max == 0 && ring_data_min == 0) {
+ ring_data_max = current_value + 800;
+ 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;
+ }
+ calibration = {
+ .default_value = ring_data_default,
+ .max_value = ring_data_max,
+ .min_value = ring_data_min,
+ };
+ return DriverResult::Success;
+}
+
void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) {
constexpr u16 DefaultStickCenter{2048};
constexpr u16 DefaultStickRange{1740};