Closed mheden closed 5 years ago
In what scenario are you lacking hook support?
As implemented, ESC_state only act on requests from the master, which is the only normal way to trigger a state change except when triggering an error and doing the error transition OP->SAFEOP|E. So, doing a request by the slave ALStatus state change would only make sense/be valid when there is an error, right?
I second what you say above on ESC_state, would an alternative way be to add a trigger ERROR function, going to new state, set error and integrate some hook, eg. post state change hook. I believe this could be handy if you would like to trigger an error from outside the "stack" instead of calling the sequence above for the watchdog.
Yes, in my case I wanted to be informed about watchdog timeouts. Since I react to all other transitions via the post_state_change_hook
I think it would make sense to also call that on "internal stack errors" so there is "one point of information".
Could you create an exmaple that would cover your needs?
@mheden , check the follwoing proposal at feature/esc_go_to_errorstate
The user/application should use it / watchdog, invalid outputs goto safe-op with error bit set / ESC_ALstatusgotoerror((ESCsafeop | ESCerror), ALERR_WATCHDOG);
ping @mheden, Opinion, should ESC_ALstatusgotoerror also ESC_stopoutput , can be conditional on OP?
Sorry, missed this.
Looks good to me. I think it makes sense to call ESC_stopoutput
from ESC_ALstatusgotoerror
since all errors should make state transitions from OP. Or are there any errors that can appear together with OP?
Don’t think so.
It seems like calls to
ESC_ALstatus
don't trigger state hooks.For example in the demo application:
This will not trigger the
post_state_change_hook
which I think it should.I think it is caused by
ESC_state
are looking atALcontrol
rather thanALstatus
. On the other hand, I'm not really sure of how it should be handled sinceESC_state
is settingALstatus
if the transition is successful.Maybe
ESC_ALstatus
should call hooks as well?