Closed nattgris closed 3 years ago
Looks great, please rebase.
I see that there are checks along the lines of net->state == STATE_INIT
in some places. I think they do the right thing even though that condition now only matches the final sub-state, because that's the only sub-state which give these checks a chance to run as far as I can see. But probably worth to take a closer look and verify that, or if any of them need to expand the check to include the other two init states, or at least change the checks to STATE_INIT_COMM
to make it clear.
Treat each sub-state as a separate step in the FSM processing, to expose the sub-states to the application NMT callback, which may need to do different things depending on whether the application or only the communication is reset.
The previous STATE_INIT in an NMT callback now corresponds to STATE_INIT_COMM, so add an alias to keep the behaviour of existing callbacks.
Move the reset callback to the NMT command reception to avoid having to disable it during power-on initialisation.