abstrakraft / cwiid

Linux Nintendo Wiimote interface
cwiid.org
GNU General Public License v2.0
287 stars 100 forks source link

Duplicate table entries on output with wm.state with expanded rpt_mode #40

Open knoxvillesjoker opened 4 years ago

knoxvillesjoker commented 4 years ago

Setting wiimote with this: import cwiid wm=cwiid.wiimote() wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC | cwiid.RPT_NUNCHUK

then running wm.state yields: {'rpt_mode' : 22, 'led' : 2, 'rumble' : 0, 'battery': 120, 'ext_type': 1, 'error': 0, 'buttons': 0, 'acc': (145, 128, 145), 'nunchuk': {'stick': (125, 129), 'acc': (171, 117, 132), 'buttons': 0}}

The problem is that there are two readings for: acc, and buttons in the array. This creates errors with dictionaries in python as when you try to pull one of those duplicate keys out it errors out.