Each polling period (=10ms=sixaxis refresh rate), emuclient processes all queued events.
This means that depending on the mouse refresh rate, emuclient may process one or several mouse motion events.
- (rate=100Hz) => 1 event max
- (rate=500Hz) => 5 events max
- (rate=1000Hz) => 10 events max
In a single polling period, emuclient may receive several events, but only performs a single sixaxis status refresh. Therefore, mouse motion events have to be merged into a single one that is the average mouse motion event. This allows to reach a better precision since no event is ignored.
The average mouse motion event is translated to a sixaxis axis thanks to the following formula:
I usually use exp=1 so that the simplified formula is:
The dead zone has also to be removed:
if res>0: res=res+dz
if res<0: res=res-dz
Different multipliers, exponent and dead zones may be set for x and y mouse motions.
This calculation supposes the dead zone is rectangular.
Following to the suggestion of a reader, I decided to test a different dead zone shape.
With a circular dead zone:
if x!=0 and y!=0:
I also improved the result precision by storing each intermediate result as a double (and not an integer). Only the final result is converted to an integer.
I built a test package for people that want to try these new things.
Just remember to set the same value for both x and y dead zones.
Let me know the results of your tests!