Pad Force Vs Velocity Implementation and Testing using STM32
Hello,
I am trying to implement a STM32 based pad assessment functionality, in which the applied force should be converted to the velocity based on user set polynomial degrees as in below image. I have implemented the code to calculate velocity based on ADC values and apply it to pad curve functionality. But I don't have any mechanical setup to measure the force applied so I can plot the Force vs Velocity curves. I would like to get some feedback on the implementation and need some idea on how to test the same.

FinalVelocity = ApplyPadCurve(user_velocity, usr_degree);
uint8_t ApplyPadCurve(uint8_t velocity, uint8_t degree)
{
uint8_t FinalscaledValue = scaledValue;
switch (degree)
{
case 1: // Curve deg 1 (Linear)
FinalscaledValue = scaledValue;
break;
case 2: // Curve deg 2 (Quadratic)
FinalscaledValue = pow(scaledValue, 2.0) / 100;
break;
case 3: // Curve deg 3 (Cubic)
FinalscaledValue = pow(scaledValue, 3.0) / pow(100, 2.0);
break;
case 4: // Curve deg 4 (Quartic)
FinalscaledValue = pow(scaledValue, 4.0) / pow(100, 3.0);
break;
default:
break;
}
return FinalscaledValue;
}
