hsm icon indicating copy to clipboard operation
hsm copied to clipboard

How to split a large state machine into several small state machines and put them in different files

Open mjt123 opened this issue 2 years ago • 2 comments

A large state machine results in many lines of code,so i want to put some sub states in other files,How can I achieve it thanks

mjt123 avatar Feb 09 '22 10:02 mjt123

Hi @mjt123. Yes, you're right, and not the first to bring this up. I need to add a section to the Wiki/Book about how to do this. In the meantime, here's an answer I gave to a similar question a while back: https://github.com/amaiorano/hsm/issues/9#issuecomment-352260330. See the very last paragraph for one way to split up large HSMs so that you have only the root state declared in header files. Let me know if this helps.

amaiorano avatar Feb 14 '22 21:02 amaiorano

hi @amaiorano,it works.And as you said, dealing with dependencies between States is cumbersome. Thank you for your advice,expected seeing this part of the wiki.

mjt123 avatar Feb 17 '22 03:02 mjt123