Handle Wii-U Nunchuks: nearly useless calibration data (0, 127, 0)

This commit is contained in:
Ryan Pavlik
2013-09-26 17:10:56 -05:00
parent 4b6094e031
commit 385ce79768

View File

@@ -98,6 +98,15 @@ int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, un
nc->js.min.x, nc->js.max.x, nc->js.center.x,
nc->js.min.y, nc->js.max.y, nc->js.center.y);
/* If the calibration data makes no sense, fake it. */
if (nc->js.max.x < nc->js.center.x) {
nc->js.max.x = 255;
}
if (nc->js.max.y < nc->js.center.y) {
nc->js.max.y = 255;
}
/* default the thresholds to the same as the wiimote */
nc->orient_threshold = wm->orient_threshold;
nc->accel_threshold = wm->accel_threshold;