tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.77k stars 865 forks source link

Joystick axes reduced by 2 for values of >2 in range -32767..32767 on Windows #4198

Open andrewfstratton opened 3 months ago

andrewfstratton commented 3 months ago

Using: Rpi Pico/Badger 2040/Wavshare RP2040 Zero - joystick, USB HID - setup is:

Here is the behaviour:

This has the same, incorrect, behaviour for other axis

Note: I have checked the joystick package Max/Min In/Out conversion and that seems to work fine (I copied the code into Go playground and tried it for the same values).

I think the issue is further down, possibly in tinyusb itself.

I have tried it on another PC (win 10) and got the same error above - the 0.99994 value for 32767.

I did try this on MacOS and Android - but neither recognised the Pico - so I couldn't get any results there...

I may have made some stupid mistake in my code - which I can't see - but I do think there is some issue there that most users wouldn't see but is incorrect since the axis cannot reach their maximum limit.

andrewfstratton commented 3 months ago

I have update the issue with further clarification when I discovered that the error happens for values of >2 for an axis range of -32767..32767