PicoMite V6.01.00 betas


Author Message
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6104
Posted: 06:22pm 08 Sep 2025      

@Peter,

I have tried to use the WII support commands as good as I can, but I am stumbling upon a behaviour I think is a bug.

When using a WII OPEN command, and there is no WII classic connected, it errors.
And when doing a WII CLOSE, the message is that there is no WII channel open. So the error closes the WII support in MMBasic.

Also when there is a WII NUNCHUCK connected, the WII OPEN command errors.
And when doing a WII CLOSE the message is that there is no WII channel open. Reading the ERRMESG$, the driver has detected a NUNCHUCK, but the channel is closed.
In this case I can WII NUNCHUCK OPEN, to enable support for the NUNCHUCK.

Up to here it all works. However....

The WII NUNCHUCK channel is not opened.
When I do a DEVICE(WII NUNCHUCK T) to read the type the error presented is:
Print "type =";Hex$(DEVICE(wii nunchuck T))
Error : Not open


I have tried adding delays, to make sure there is sufficient time between closing the WII and opening the WII NUNCHUCK, but that does not help.

Please find attached a minimal demo program.

connect a nunchuck to system i2c
'opens classic wii
on error skip 1
WII OPEN
? MM.ERRMSG$

'no classic, then open
WII NUNCHUCK OPEN

? hex$(DEVICE(WII NUNCHUCK T))


The strange thing is, that when you do the reverse (connect a classic, open a nunchuck channel first) it does work as planned.

connect a classic wii controller
'opens nunchuck wii
on error skip 1
WII NUNCHUCK OPEN
? MM.ERRMSG$

'no nunchuck, then open a classic
WII OPEN

? hex$(DEVICE(WII T))


Please comment if I am doing something wrong, or if this is a bug.
Note that I cannot use method 2 (that works) due to the error message. When opening a nunchuck with classic attached, the error message is "this is not a nunchuck", but it does not say that it is a classic (negative message, it is not xxx, but what is it ?). When opening a classic with nunchuck attached the error message is "a nunchuck is attached", this is the positive message, so I can immediately open the right thing.

Volhout
Edited 2025-09-09 18:01 by Volhout