Comments (6)
Perhaps, one way to tackle issues of this kind could be to generalize programmatic shutdown a little more. That is, instead of "holding" shutdown, there could be (shutdown-abort)
to cancel shutdown entirely when event-shutdown
is received, (shutdown)
to shut down programmatically once ready to do so, and (get-powerswitch)
to get and monitor the power switch state. Then, in addition to powering on as usual, the application can take control of shutdown behavior whereas the firmware only provides the necessary APIs instead of implementing a specific behavior?
Edit: Figured that in our use case this could be even simpler: Use ALWAYS_ON
plus provide programmatic (shutdown)
and (get-powerswitch)
, so holding or cancelling the shutdown event is not necessary since the VESC won't shutdown automatically anyway. That is, if ALWAYS_ON
also uses the power switch to turn on.
from bldc.
The intention is to enable the gates and abort shutdown if it does not succeed after two seconds (as can happen of the button is toggled in-between). Maybe there is something wrong in the logic though. Can you describe the exact steps to reproduce the problem together with a small example lbm program?
from bldc.
I don't have a functioning setup at hand right now, unfortunately, but I would imagine that the following program should demonstrate the issue:
(defun do-startup () {
(looprange i 0 5 {
(set-duty 0.1)
(yield 500000)
})
(set-duty 0.0)
})
(defun do-shutdown () {
(looprange i 0 5 {
(set-duty -0.1)
(yield 500000)
})
(set-duty 0.0)
})
(do-startup)
(event-register-handler (self))
(event-enable 'event-shutdown)
(loopwhile true
(recv
(event-shutdown {
(shutdown-hold true)
(print "Performing action upon shutdown...")
(do-shutdown)
(print "Action complete. Shutting down...")
(shutdown-hold false)
; LBM should terminate now unless
; power has been switched back on.
(yield 500000)
(print "Shutdown cancelled. Restarting...")
; If cancelled, this should work:
(do-startup)
})
)
)
(unreachable)
Upon boot, motor should drive forwards for a bit. Upon shutdown, motor should drive backwards for a bit before the VESC is turned off. Issues appears to arise when cycling the power switch between shutdown-hold true
and shutdown-hold false
, in that motors won't move anymore and/or the VESC won't turn off afterwards.
Will take a closer look as soon as I have a working setup again, but perhaps that's helpful already?
from bldc.
Got around to testing again meanwhile. Appears that the above program is too stripped-down to show the issues originally described. Will try to improve. However, it seems to show that the shutdown event is emitted only once, whereas subsequent toggles skip the event and shut the VESC down immediately.
Btw, I forgot to mention that the power switch setting used is ALWAYS_OFF
. Using a 60_75_MK2 atm, 6.05 beta 22.
from bldc.
Related Issues (20)
- SAFETY RISK: lisp app-disable-output causes ADC app to be locked to a certain speed HOT 2
- LispBM Impossible to do "Read Only" with I2C HOT 4
- BUG: can-cmd not working reliable HOT 16
- Developer Question: STM32F415 Implementation
- COMM_GET_IMU_DATA controller_id not set HOT 2
- Disabling permanent UART and Bluetooth interaction confusing, causes lockout with Float package HOT 5
- $ make **WARNING** ARM-SDK not in D:/Work/Nazarite/FOC/VESC/bldc-master/tools/gcc-arm-none-eabi-7-2018-q2-update Please run 'make arm_sdk_install'
- [LispBM] Programmatically delaying the shutdown event HOT 4
- [LispBM] Registering an extension that doesn't start with "ext-" silently passes HOT 5
- It needs more default number HFI start samples to resolve the initial ambiguity HOT 1
- Feature Request: add option to invert wake up switch function from normally closed to normally open button
- Better support for digital/ switch-based brakes HOT 3
- Waiting for vesc suport step/dir interface!
- Feature Request:How to customize my VESC firmware?
- Can 1 STM32F drive 2 mosfet Driver? HOT 4
- I want to drive two mosfet drivers with one stm32f like foCbox unity. I'm going to use two DRV8301's. I don't know if VESC allows 1 STM32F to receive SPI from two Mosfet Drivers. Is there anyone who can help me with the PROJECT? HOT 2
- Feature request: Redundant analog signals for throttle and brake
- Feature Request: Disable Field Weakening at compile HOT 2
- Current control tuning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bldc.