Also includes an update to set power limits from other threads (like a display) and
prepares support for PAS torque sensors.
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
For gearless electric bicycles, riding up the slope and during start,
good torque support from the motor helps the rider ride with less
effort. Pedal assist based on cadence provides higher torque with higher
pedalling speed. In the situations mentioned above, where user naturally
pedals slow, aid from cadence based system is less. On a geared setup,
changing to low gear comes to the rider's help.
Here another control type is provided - Constant Torque, whenever the
rider pedals, motor would provide constant torque. The torque value can
be set using 'PAS max current' setting thus acting as fine PAS assist
level.
This type of control is similar to 'Basic PAS, constant throttle' of
'PAS Control Schemes' [1], with the difference that throttle setting
in that article corresponds to speed, while here torque.
Also riding experience on some of the popular (not high end) e-bicycles
having PAS indicates they might be having this kind of control
internally.
[1] https://ebikes.ca/learn/pedal-assist.html
Nose angle adjustment, similar in purpose as constant tiltback
but it is proportional to erpm aka speed.
Signed-off-by: Dado Mista <dadomista@gmail.com>
-Fix D term to use angle rather than error (which includes tilt steps)
-Switch TT to Biquad (Clear z1 z2)
-Split TT Relax speed
-Add Biquad to D term
-Add console command to graph specific variables
-Add console command to dump realtime data from specific variables
Increase motor timeout to account for sleep inaccuracy and whatever else.
Set motor timeout to a variable, to reduce calculation repetition.
Only calculate motor timeout after config is set, so we never divide by 0.
Reorder functions so exposed functions are at the start.
Make app's internal functions static.
With this hook the brake can be overriden from the hw_*.c file without
polluting the app configuration UI.
Some examples of commanded braking:
* Tilt/crash sensor
* Gear shift sensor
* Emergency stop
* Kill switch
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>