vedderb / bldc

The VESC motor control firmware
2.16k stars 1.35k forks source link

ADC app does not fail safe when input out of bounds #463

Closed Teslafly closed 2 years ago

Teslafly commented 2 years ago

In the vesc discord, it was noted that pulldown resistors on the adc input do not fail safe in the "current reverse center" mode. When the throttle is disconnected and the adc falls to 0v, the vesc goes full reverse.

Since hall throttles generally have a non zero minimum voltage ~0.5v if we fail into the mc_interface_set_brake_current(timeout_get_brake_current()) mode when the input is outside of config.voltage_start / config.voltage_end plus some tolerance, we can fail safe in modes where 0v would otherwise be a throttle input.

I propose 3 new adc app settings:

Teslafly commented 2 years ago

voltage_start_limit (ADC1 min voltage limit) probably needs to be bounded to a minimum of 0v.

vedderb commented 2 years ago

Here is an attempt at fixing it: https://github.com/vedderb/bldc/commit/3a530ac3f7b43c06acac807248ae05fef8c1ae97 It is in the latest beta build now too. Can you give me a try and let me know if it works?

Teslafly commented 2 years ago

As per the discord server, this has been tested successfully. Closing.