ソースを参照

Fix gyro of SC in switch mode being to sensitive (#189)

* fix gyro-roll data in switch mode being to fast compared to Steam mode or Switch Pro Controller

* fix gyro-pitch and yaw sensitivity in steam mode
Bambusbro 2 ヶ月 前
親
コミット
7acdf43528
1 ファイル変更、9 行追加、0 行削除
  1. 9 0
      OpenPuck/mode_switch_pro.cpp

+ 9 - 0
OpenPuck/mode_switch_pro.cpp

@@ -531,6 +531,15 @@ static void switchProBuild(uint8_t slot, uint8_t out[63])
 	int16_t groll = gscale((int16_t)g_in[bond].gy);
 	int16_t gpitch = gscale((int16_t)(-(int16_t)g_in[bond].gx));
 	int16_t gyaw = gscale((int16_t)g_in[bond].gz);
+
+	// The physical yaw of the SC is making the roll (or yaw if facing to wall like on switch) move to fast in switch mode.
+	// Reducing it to 80% sensitivity. Using int32 to fix a possible overflow during the multiplication.
+	groll = (int16_t)(((int32_t)groll * 4) / 5);
+
+	// Other sensors were also a little off. Reducing to 90% sensitivity matches Switch Pro Controller and Steam mode.
+	gpitch = (int16_t)(((int32_t)gpitch * 9) / 10);
+	gyaw = (int16_t)(((int32_t)gyaw * 9) / 10);
+
 	for (int k = 0; k < 3; k++) {
 		int o = 12 + k * 12;
 		out[o + 0] = aX & 0xFF;