Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAFETY RISK: lisp app-disable-output causes ADC app to be locked to a certain speed #655

Open
1zun4 opened this issue Sep 20, 2023 · 2 comments

Comments

@1zun4
Copy link
Contributor

1zun4 commented Sep 20, 2023

So, I experienced the following and I still have to confirm this correctly, but from what I could tell it seems app-disable-output will block the ADC code and cause the motor to continue running at the last throttle value.

https://github.com/vedderb/bldc/blob/4e0288d37f203b58acacd735df81ce397319102f/applications/app_adc.c#L319C1-L323C4

If the ADC app is disabled it will not run any set-current, set-rpm etc functions and therefore it stays at this value (and I am not sure if there is any timeout applied, I do not think so...)

It also does not help to override the values to zero first, like this:

(if (or (= off 1) (= lock 1))
            (if (not (app-is-output-disabled)) ; Disable output when scooter is turned off
                {
                    (app-adc-override 0 0)
                    (app-adc-override 1 0)
                    (app-disable-output -1)
                }
                
            )
            (if (app-is-output-disabled) ; Enable output when scooter is turned on
                (app-disable-output 0)
            )
)

What I have not tried yet is setting the current-rel to 0 myself, before disabling the app.

@vedderb
Copy link
Owner

vedderb commented Sep 23, 2023

(app-disable-output) will stop the app from sending further motor commands, but if the motor is already running it will keep running. You can use set-current 0 afterwards to stop the motor if you do not want it to keep running. Maybe it is better to update app-disable-output so that the motor is released after using it.

@1zun4
Copy link
Contributor Author

1zun4 commented Sep 23, 2023

Yes that would make sense. I also think that below the app_is_output_disabled, it does the same with timeout_has_timeout, so it might keep running there as well?

https://github.com/vedderb/bldc/blob/4e0288d37f203b58acacd735df81ce397319102f/applications/app_adc.c#L319C1-L327C4

1zun4 added a commit to m365fw/vesc_m365_dash that referenced this issue Sep 23, 2023
This issue was discussed in vedderb/bldc#655
> If the ADC app is disabled it will not run any set-current, set-rpm etc functions and therefore it stays at this value (and I am not sure if there is any timeout applied, I do not think so...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants