Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Maker: Reliable Board Reset #13252
Perform a stateless board reset and full re-initialization every time you run the app.
At least these; there are probably more.
Both of these problems were caused by a complex stateful initialization process, that was in part driven by how long it used to take for the board to connect. It went like this:
The LED color issue arises from the fact that their component reset doesn't work properly (and I suspect this is true for many components). The multiple tabs issue happens because the first tab doesn't know that the second tab has invalidated its cached port/board/components.
The new approach
Stateless is the best! We now treat every run like the first run, and do the full initialization process (which is super fast now).
On reset we call Firmata's
To do this we're fighting with some statefulness within the Firmata, Johnny-Five and Playground-IO libraries. This was partially resolved in #13172 which stopped Johnny-Five from using its static board cache when setting up components by explicitly injecting a board object into each component. For this change we've also modified playground-io again to make it possible to construct it more than once on a page. I believe this is a legitimate bug in playground-io and have also submitted this change upstream so hopefully we can switch back if/when it's accepted.
There's a ton of cleanup that can happen in BoardController now - a lot of the initialization code is jumping through hoops to handle this now-defunct board/component caching nicely - but the stability change of this benefit is so great that I'd like to ship this minimal change and make the rest a refactor.