vedderb / bldc

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

Log faults if active on startup #495

Closed avlasic closed 2 years ago

avlasic commented 2 years ago

Currently if fault is active on startup it won't be logged to terminal so it is' hard to notice faults like booting from watchdog reset. Also current offset and unbalace faults shoudn't be triggered before dccal , since after that vairables are filled with real data from adc.

vedderb commented 2 years ago

Can you see if this commit gives the same result? https://github.com/vedderb/bldc/commit/1309ece84be5f69968f7fc149d0f9e241613e082 Then you don't have to check dccal_done in the isr-code. Hopefully the comment also explains why the faults behave the way they do.

avlasic commented 2 years ago

That commit does give me same result, logs both first fault (like watchdog) that is gone or still active as it should.

As for dccal_done on current offsets, that check is done in 1ms task, not isr code so I think it should be fine to do it, since I still get FAULT_CODE_HIGH_OFFSET_CURRENT_SENSOR with run calibration on boot to off.

vedderb commented 2 years ago

That sounds good. Is it ok to close this one then?