casainho wrote: ↑
Jun 14 2018 2:13am
I suggest you to make a branch or fork so you can add it and we can discuss here the structure and where it makes morr sense to add the code.
Hm, I just had a short look at the recent code. The speed limit is already enabled/disabled by the display via parameter P3. The speed control is not just a cut off at the speed limit, but a speed control according to the throttle position (or PAS state).
edit: ah, now I found the cut off code
, but I can't find any call of the function set_speed_erps_max_to_motor_controller
And the definition of the default values
I think the wanted function is an enabled speed limit by default, when switching on the system, for legality issues, and a hidden function to disable the limit until the system is switched off again.
Is that right?
I've added a first try to a new branch at github
, it's not tested in hardware yet.
The speed limit is disabled by sending the "code" by the brake lever as described in the tab "alternative fork
" of the windows tutorial. The cheat step duration is defined in the main.h to one second each at the moment, to avoid the need of updating the java tool. The slow loop runs at 10Hz at casainhos master, in my fork it runs at 50Hz.
The cheat works like this: Hold the brake lever for cheat time 1, then release it for the duration of cheat time 2, then pull it again for cheat time 3, then release it again. For step 1 with a value of 10, the release of the brake lever is recognized as valid for a period of 1 to 1.5 seconds after pulling and continues with step 2. If the lever is released too early or too late, the whole procedure is reset and you have to start all over again. Currently the user does not get any feedback on whether the cheat has been activated.