Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Custom hardware, STM32 with FreeJoy as joystick, can't bind Rx axis

Discussion in 'Input System' started by JDMulti, Jul 7, 2020.

  1. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    For the people experimenting with hardware and Unity. I do this quite often but now I hit a hard brick wall. :)

    I'm trying to use a STM32 to emulate a joystick named "FreeJoy" which has a magnetic sensor connect and using the new Input System

    Using magnet I can emulate a joystick, rotating the magnet shows a value between -1 and 1. This solution works just fine when using any kind of game controller preview software. I can see the value going up and down as I rotate the magnet over the sensor and having the FreeJoy update the value within the software.

    However where the issue comes is that I try to get the same value output by the FreeJoy to be used within Unity.

    I can see the FreeJoy joystick just fine

    upload_2020-7-7_22-12-44.png

    I can see the Rotation Axis value update whenever I double click the FreeJoy in the above image

    upload_2020-7-7_22-14-43.png

    However when I want to bind anything to 'Rx' using the 'Input Actions' menu from the Input System, I don't see any axis at all

    upload_2020-7-7_22-15-52.png

    Now I have 2 questions:

    1.) Why can't I bind the rotation axis from the binding menu?
    2.) While double click the FreeJoy and see the Rx value, I noticed that there is a deadzone between max value and min value where the value switch is happening. Example: from 0.99 to 1 but then when I rotate a little it stays 1 for a while and then turns into -0.01. This is however not happening in any game controller preview software else then Unity. I can 100% guarantee that the data from the sensor isn't behaving like that but that Unity is somehow adding a deadzone under the hood.

    Does someone know how I can get the FreeJoy work properly?
    At the moment I have no clue how to fix it as the sensor works just fine but Unity seems not to work that well with the sensor. Only solution I have now it remove the FreeJoy and send data over Serial and get the magnet sensor data that way.