[WiiC] Nunchuck connection issues and workarround
Brought to you by:
gabriele82rm
|
From: Simon W. <me...@si...> - 2011-11-02 17:35:39
|
dear all, I am currently using wiic for a 3d/music generation application (details can be found here: http://simonwallner.at/blog/sputnik-announcement) and I ran into troubles using the nunchuck attachment. Everything was working fine when using the provided sample implementation but not with my own code. The Problem is, as it seems, that connecting to an attachment requires some messages sent from(to?) the wiimote. If too much time passes between "connect" and the first (few?) poll() calls the handshake with the nunchuck fails. To fix this, I just threw cout << "forcing nunchuck handshake completion" << std::endl; while (wiimotes[0].ExpansionDevice.GetType() != wiimotes[0].ExpansionDevice.TYPE_NUNCHUK) wii.Poll(); right after connect(). This repeatedly polls the wiimote until the handshake is completed. It is a very dirty hack, but it woks most of the time :D It would be nice, if someone adds this hint to the website, or maybe comes up with more elaborate fix in source. It would be nice if this time critical part was encapsulated in the connect method. best, Simon |