by codeulike · 5y ago · 0 comments
If you have multiple outputs you can also have a scheduling/prioritization system for the subtasks.
And yes, use interrupts or multiple timers to detect only changed parts without having to compare current input to previous input.
It's basically the same problem as updating a browser DOM in response to application state changes.
Also, there sometimes ARE interrupts meshed in with these main loop based systems (for whatever reason). They just aren't predominant. If your willing to through more hardware at things, you can typically always transform anything into a buffer.
This is a great example of a little knowledge being dangerous. There's a reason control systems are not implemented the same way as a browser DOM. There's a reason control systems are designed to avoid subtasks, conditional execution, interrupts (as much as possible) and complex data models. The reasons are pretty damn solid, IMO.
Conceptually, you can talk about the two domains as being somehow equivalent. That says nothing about the appropriate implementations.
If only one sensor input changes then intermediate computations that don't depend on it don't need to be updated.
And you still need a control loop to look for sensor changes? Its just a way of caching most of the computation?