Ticket #93 (closed defect: fixed)
Probable error in wiimotion message decoding
| Reported by: | BlaiseGassend | Owned by: | dsmith |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | libcwiid | Version: | 0.6.00 |
| Keywords: | Cc: |
Description
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 |
(uint16_t)data[2];
motionplus_mesg->angle_rate[CWIID_THETA] = ((uint16_t)data[4] & 0xFC)<<6 |
(uint16_t)data[1];
motionplus_mesg->angle_rate[CWIID_PSI] = ((uint16_t)data[3] & 0xFC)<<6 |
(uint16_t)data[0];
Change History
Note: See
TracTickets for help on using
tickets.
