Ticket #93 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Probable error in wiimotion message decoding

Reported by: BlaiseGassend Owned by: dsmith
Priority: major Milestone:
Component: libcwiid Version: 0.6.00
Keywords: Cc:


I suspect that the wiimotion message decoding in libcwiid/process.c, lines 246 to 251, r200 is incorrect.

Indeed, it is anding the high byte with with 0xFA (11111010b) instead of 0xFC (11111100). 0xFC is also consistent with  http://randomhacksofboredom.blogspot.com/2009/06/wii-motion-plus-arduino-love.html

I suspect that because of this bug, only the top 5 bits are accurate.

I believe that the following code is more accurate:

                        motionplus_mesg->angle_rate[CWIID_PHI]   = ((uint16_t)data[5] & 0xFC)<<6 |
                        motionplus_mesg->angle_rate[CWIID_THETA] = ((uint16_t)data[4] & 0xFC)<<6 |
                        motionplus_mesg->angle_rate[CWIID_PSI]   = ((uint16_t)data[3] & 0xFC)<<6 |

Change History

Changed 8 years ago by dsmith

  • status changed from new to closed
  • resolution set to fixed

Good call - that's what I get for manually calculating bitfields in hex. Fixed (r201).

Note: See TracTickets for help on using tickets.