Two bugs correction in the WiiRemote framewor

  • Nobody/Anonymous


    There is a bug in the Nunchuk calibration data, the array indices are not set correctly, and the read values are not correct.  Here is the solution:

    nunchukJoyStickCalibData.x_max = (dp[15] ^ 0x17) + 0x17;
    nunchukJoyStickCalibData.x_min = (dp[16] ^ 0x17) + 0x17;
    nunchukJoyStickCalibData.x_center = (dp[17] ^ 0x17) + 0x17;
    nunchukJoyStickCalibData.y_max = (dp[18] ^ 0x17) + 0x17;
    nunchukJoyStickCalibData.y_min = (dp[19] ^ 0x17) + 0x17;
    nunchukJoyStickCalibData.y_center = (dp[20] ^ 0x17) + 0x17;

    Also, there is a memory leak in the WiiRemoteFramework when closing the connection, if the channels' delegates are not set to nil.

    if (cchan){
        if ([wiiDevice isConnected]) do {

            // ---> set delegate to nil
            [cchan setDelegate:nil];

            ret = [cchan closeChannel];
        }while(ret != kIOReturnSuccess && trycount < 10);
        [cchan release];

    You also have to do the same for the ichan code right after that.

    I hope this will help!

    All the Best,

    • Jasen Jacobsen

      Jasen Jacobsen - 2007-02-10

      Thanks.  I made these changes in my branch.  They should get merged into the trunk when Hiroaki gets back.

      - Jasen.

    • Nobody/Anonymous

      Thanks, updated also.  In my version i've also added a callback to the delegate telling them calibration data has been received.  Seemed sensible to me?



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks