mirror of
https://github.com/ShikyC/Taiko-Drum-Controller-Arduino.git
synced 2024-11-23 22:10:58 +01:00
泰勒展开yyds
This commit is contained in:
parent
5cd0dfe75c
commit
620ef18892
@ -113,7 +113,7 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
for (byte p = 0; p < PLAYERS; p++) {
|
for (byte p = 0; p < PLAYERS; p++) {
|
||||||
|
|
||||||
for (byte i = 0; i < CHANNELS; i++) {
|
for (byte i = 0; i < CHANNELS; i++) {
|
||||||
@ -126,7 +126,11 @@ void loop() {
|
|||||||
}
|
}
|
||||||
lastPower[p][i] = power[p][i];
|
lastPower[p][i] = power[p][i];
|
||||||
#else
|
#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));
|
axisValues[p][i] = AXIS_RANGE * (v >= MAX_THRES ? 1 : (v / MAX_THRES));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user