泰勒展开yyds

This commit is contained in:
ShikyC 2024-01-25 15:32:23 -08:00
parent 5cd0dfe75c
commit 620ef18892

View File

@ -113,7 +113,7 @@ void setup() {
}
void loop() {
for (byte p = 0; p < PLAYERS; p++) {
for (byte i = 0; i < CHANNELS; i++) {
@ -126,7 +126,11 @@ void loop() {
}
lastPower[p][i] = power[p][i];
#else
float v = pow(5.0, sensitivities[p][i] / 2048.0 - 1) * power[p][i];
float x = sensitivities[p][i] / 2048.0 - 1;
float x2 = x * x;
float x3 = x2 * x;
float x4 = x3 * x;
float v = 1.0 + x + 0.5 * x2 + 0.166667 * x3;
axisValues[p][i] = AXIS_RANGE * (v >= MAX_THRES ? 1 : (v / MAX_THRES));
#endif
}