My team has been using a speacial sin curve array to tone down the sensitivity. It has kind of been a hand-me-down for four years now.
const rom unsigned char joystick_values[256] = {
0, 0, 0, 0, 0, 0, 0, 0, // 0 - 7
0, 0, 0, 0, 0, 8, 16, 24, // 8 - 15
30, 36, 41, 45, 50, 53, 57, 60, // 16 - 23
63, 65, 68, 70, 72, 74, 76, 78, // 24 - 31
80, 81, 83, 84, 86, 87, 88, 89, // 32 - 39
90, 91, 92, 93, 94, 95, 96, 97, // 40 - 47
98, 98, 99, 100, 101, 101, 102, 102, // 48 - 55
103, 104, 104, 105, 105, 106, 106, 107, // 56 - 63
107, 108, 108, 109, 109, 110, 110, 110, // 64 - 71
111, 111, 112, 112, 112, 113, 113, 114, // 72 - 79
114, 114, 115, 115, 115, 116, 116, 116, // 80 - 87
117, 117, 117, 117, 118, 118, 118, 119, // 88 - 95
119, 119, 120, 120, 120, 120, 121, 121, // 96 - 103
121, 121, 122, 122, 122, 122, 123, 123, // 104 - 111
123, 124, 124, 124, 124, 125, 125, 125, // 112 - 119
125, 126, 126, 126, 126, 127, 127, 127, // 120 - 127
127, 127, 128, 128, 128, 128, 129, 129, // 128 - 135
129, 129, 130, 130, 130, 130, 131, 131, // 136 - 143
131, 132, 132, 132, 132, 133, 133, 133, // 144 - 151
133, 134, 134, 134, 134, 135, 135, 135, // 152 - 159
136, 136, 136, 137, 137, 137, 137, 138, // 160 - 167
138, 138, 139, 139, 139, 140, 140, 140, // 168 - 175
141, 141, 142, 142, 142, 143, 143, 144, // 176 - 183
144, 144, 145, 145, 146, 146, 147, 147, // 184 - 191
148, 148, 149, 149, 150, 150, 151, 152, // 192 - 199
152, 153, 153, 154, 155, 156, 156, 157, // 200 - 207
158, 159, 160, 161, 162, 163, 164, 165, // 208 - 215
166, 167, 168, 170, 171, 173, 174, 176, // 216 - 223
178, 180, 182, 184, 186, 189, 191, 194, // 224 - 231
197, 201, 204, 209, 213, 218, 224, 230, // 232 - 239
238, 246, 255, 255, 255, 255, 255, 255, // 240 - 247
255, 255, 255, 255, 255, 255, 255, 255 // 248 - 255
};
It’s worked for us. Just put the array like this:
pwm_01 = joystick_values[p1_y];
Do this for all pwm’s you want dampend. Hope it works.
As for limiting speed, I have no idea what the arguments of the Arcade function are. If set pwms are what you are using to change the pwm values, they are commented out (you probably know that already). You also have it set 177 on the 77 if statement and 77 on the 177 if statement. Would switching those two help?