May i offer Lebowski polynomal throttle function i was fascinated by it from the start...
There are three coefficients you can set in code that determine the curve. a, b, and c are floats because they can be less then 1.
x is the throttle value and y is the result.
y = a*x + b*x^2 + c*x^3
a, b and c are preset coefficients. Using them you can shape your throttle curve to your liking.
See here the excerpt from the manual...
Upto 2 analog throttles can be connected to the controller IC. Options a and b are for calibration. The IC
will measure the throttle voltage for throttle closed and throttle open. The throttle closed voltage must be
lower than the throttle open voltage.
Either one of the throttle channels can be used for variable strength regen. This can be achieved by
using negative polynomal coefficients (see the next slide)
When analog throttles are used also the 'reverse' switch can be used to select reverse.
Based on the calibration information the throttle voltage will be transformed into variable x (x1 for throttle 1,
x2 for throttle 2) in the range of 0 to 1. Out of range voltages are rounded to 0 or 1.
Variables x1,2 are transformed into variables y1,2 by means of a polynomal function (the purpose of which
is to be able to make different types of throttle response curves):
y1 = a1 x1 + b1 x12 + c1 x13
y2 = a2 x2 + b2 x22 + c2 x23
Options c and d are used to input the coefficients a1,2 , b1,2 and c1,2. Valid values are between -7.999 and
+7.999.
Based on the throttle information the motor's phase current is given by:
phase current = maximum phase current * (y1 + y2)
A negative phase current means current will flow to the battery, this is how variable strength regen can
be obtained. When the conditions are such that the throttle requested phase current means that the
maximum battery current or maximum battery regen current will be violated the phase current is
automatically reduced.
