![]() |
Forum Index : Microcontroller and PC projects : CMM2: minor Nunchuk/Classic controller "bug"
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 3433 |
Hi Peter, It appears to be currently possible from MMBasic to open a Wii controller and then read from it before the firmware has performed the first (16 mSec) poll of the controller resulting in the "initial values" being returned (these appear to be zeroes, but I think I saw "garbage" on one occasion that I can't now reproduce.) It's easy enough to workaround (add a short PAUSE), but you might want to consider updating the firmware to force a poll immediately after the controller has opened, or equivalently add a pause at the end of the OPEN routine; assuming that won't block the poll. Best wishes, Tom Edited 2022-11-21 21:29 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 7739 |
Try this (untested) CMM2.zip |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 3433 |
Thanks Peter, Bill (@Turbo46) would you test this on your Nunchuck, don't forget to remove the PAUSE that you added. I'll test it with the Classic. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
Sorry, that didn't work for me. I still get zeros for the first readings of JX and JY. Bill Keep safe. Live long and prosper. |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
I had some problems with this firmware. A couple of times the keyboard would not work. Because I had the wrong keyboard option set (UK not US), I changed the keyboard option. After that the keyboard only worked very occasionally after powering down and up. No console to teraterm either. I tried another keyboard and power supply and got no improvement. Eventually I re-flashed the CMM2 with 5.07.02b6 and all is good again. It was a bit flaky before I changed the keyboard. Bill Keep safe. Live long and prosper. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 7739 |
Try again. I've reverted to an older version of the IDE. It is the only change that could affect USB since RC6 CMM2.zip |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
Thanks Peter I'll try it out tomorrow for the USB problem but it didn't help with the initial problem before I tried to change the keyboard. Bill Keep safe. Live long and prosper. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 7739 |
I have made a further change to the controller check in the latest. Somehow I think you found a 2mSec window |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
Thanks again Peter, Murphy's law always works against me. I will try again tomorrow. Bill Keep safe. Live long and prosper. |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
Sorry again, while I can change the keyboard back and forth with no problems now, JX and JY still read zero for the first time. There is a 250mS delay in my test program before I read it again to give me time to see that first reading. Bill Keep safe. Live long and prosper. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 7739 |
The controller has been polled multiple times in 250mSec so there is nothing more I can do. My "fix" was just to make sure one poll happens before the OPEN command completes. |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
Thanks for trying Peter, I guess a pause 16mS or more before polling the Nunchuk will work. Or a do - loop waiting for a non zero value. (and they do) Bill Keep safe. Live long and prosper. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 7739 |
One more try I found a variable that wasn't labelled volatile that is changed in the interrupt routine so it is possible the issue was a caching/optimisation issue CMM2.zip |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1390 |
SUCCESS! Thanks Peter, there are no zero readings on jx and jy on my first reading of the Nunchuk. No PAUSE or DO...LOOP needed. I hope that fixes any issues for Tom with his Classic. Thanks again. Bill Keep safe. Live long and prosper. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 3433 |
Lovely, I'll give it a thrash with the Wii Classic Controller at the weekend. Thanks for your dogged determination Peter. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
toml_12953 Guru ![]() Joined: 13/02/2015 Location: United StatesPosts: 314 |
Does this have all the features of the beta CMM2V5.07.02b6? If not what's the latest version? |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 3433 |
I've briefly tested it (better late than never) and as far as I can tell it is now behaving itself. Thanks again Peter. I assume so. It reports itself to be 5.07.02b8 but I don't know if Peter has "officially blessed" this as beta 8 or that is an "accident". Best wishes, Tom Edited 2022-11-29 03:06 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() |