adelyte / crescendo-for-crestron

Crescendo Framework for Crestron control systems.
https://www.adelyte.com/crestron/crescendo
Other
77 stars 26 forks source link

IndexOf inside Switcher occasionally fails to trigger a Power On. #70

Closed adelyte-austin closed 7 years ago

adelyte-austin commented 7 years ago

Crescendo v2.1.8 resolves this issue.

Below is a quote from @adelyte-chris which explains the problem and solution in depth:


Chris Massey @adelyte-chris commented 2 months ago

This problem was readily demonstrable in our troubleshooting session this morning. A change of the signal XSource_Is~ resulted in no output from the IndexOf module.

Note that the IndexOf module is one of the oldest, most used, most tested pieces of code in Crescendo—it predates the framework by four years and has not been changed in five years. It has been deployed to hundreds of systems with thousands of instances. Upon discovery of this faulty behavior, there were two possibilities for the logical state of the module:

The global variable space had been corrupted during program initialization or at runtime. Specifically, the Initialized variable held a nonzero value while the __Elements_Size variable held a value less than two. The SIMPL+ logic engine had stopped processing all instances of the IndexOf module. Using SIMPL Debugger, I attempted to reinitialize the IndexOf module (I say "attempted" because the internal state of the module cannot be determined except by sending additional commands to it). When I retriggered X__Source_Is~, everything functioned normally, which confirmed the issue was Possibility 1.

This issue is with Crestron firmware rather than the loaded software. However, I was able to create a workaround by removing all initialization from the IndexOf module and moving global variables to local variables. The tradeoff is the code will be slightly slower for switchers that are asked to switch to a source that is not configured to a particular input. For example, if a display is issued a source switch command with an audio source, IndexOf will take slightly longer to finish processing.