Commit cf173e9
authored
targets/sg48key, sgh60: fix joystick center drift (#78)
ADCDevice.Get2 assigned the raw value to a 2048-wide zone by flooring,
so zone 0 covered only [0, 2047] - entirely on the positive side of true
center - and the dead zone extended one zone (2048 counts) further in the
positive direction than in the negative one. The stick therefore
registered movement much earlier in one direction, observed as a slight
drift near center. Add half a zone before shifting so the assignment
rounds to the nearest zone and the dead zone becomes symmetric.
Both targets carry the same copy of ADCDevice; confirmed on sg48key
hardware.1 parent bf3b040 commit cf173e9
2 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
| |||
0 commit comments