Problems While Messing around with Micro's n64 pot joystick translator code 2.1

Started by Roboplodicus, April 28, 2016, 10:27:46 AM

Previous topic - Next topic

Roboplodicus

I'm messing around with the code running on these which is linked to at the bottom of the first post.  I'm basically trying to get the sensitivity just right for a pot based joystick in n64 mod.  I'm trying to increase the number of steps the joysticks has, but I'm sort of unsure what the MaxRange and MinRange constants each do.  I would assume that the max range is what the joystick would output pressed all the way to left or up(the positive x and y) but changing it affects all the directions, and I can see in the code that the mid range is used in calibration and maxrange is used in general functioning.  So basically I'm super confused :( Help please

micro

QuoteI'm basically trying to get the sensitivity just right for a pot based joystick in n64 mod.
Well in that case you don't have to do anything at all. Just leave the code as it is, excute the calibration function and it will have the right range and thus the right sensitivity.

MIN_RANGE (default 81) and MAX_RANGE (default 84) are setting the range. Forget MIN_RANGE for a moment and let's focus on MAX_RANGE. After calibration the position of the stick's X and Y axis that is reported to the controller (and to the console in the end) will be set between -MAX_RANGE and +MAX_RANGE, that means between -84 and +84. (The position is zero when the console + controller are powered up).

84 is a value that a good original N64 stick will give you. Setting a higher value than 84 will make the stick more sensitive, a lesser value will reduce the sensitivity.

For understanding the MIN_RANGE you need to consider that these potentiometer-based analogue sticks are not always linear. And also the metal shaft is not always 100% perpendicular to the base (haha). That means if you calculate the potentiometer's position in a way so you end up with having +84 when pushed right, you could end up with having only -75 when pushed all the way left.
If you change the factors so you get -84 to the left, you might get +95 when pushed right. So the MIN_RANGE and MAX_RANGE work in a way that after calibration, your stick postition when pushed into the two opposite directions will always be at least +/- MIN_RANGE and +/- MAX_RANGE at most.