adelyte / crescendo-for-crestron

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

Syncing crescendo room states when controlled externally #33

Closed patrickhampson closed 8 years ago

patrickhampson commented 8 years ago

How can I update or sync the state of a room to match the current state of the equipment? For example if a receiver is turned on via airplay, change touch panels to show that the "Airplay" source is active and the room is on.

Thanks!

adelyte-chris commented 8 years ago

By design, the Room module does not sync its source state from its associated switchers. Source selection is expected to push from a room to switchers—not pull from switchers to a room.

Your question could apply to two different use cases, the first of which I have addressed as an example of what not to do.

(1) How can I sync the feedback of a room to match the current state of its associated switcher(s)?

This use case is not very useful because it requires spaghetti code and leads to layers of bugs. It is a good example of how elementary SIMPL programming can go awry and how mucking with the internal state of a finite state machine is not a good idea.

Depending on the audio/video signal path, room power feedback needs to be some combination of ANDs and ORs. For example:

Source_Output_Is_Audio AND Receiver_Power_Is_On
OR
Source_Output_Is_Audio/Video AND TV_Power_Is_On AND Receiver_Power_Is_On
OR
Source_Output_Is_Video AND TV_Power_Is_On

To implement, modify Room as follows:

  1. Add an override input Power_Is_On_Override.
  2. Comment out __R__Power_Is_On on S-4.1.2.1.
  3. Map Power_Is_On_Override to __R__Power_Is_On.
  4. Add the external logic that properly captures room power feedback given the actual equipment.
  5. Compile and load.
  6. Test to find that power reports properly but the source name and icon do not sync and volume controls do not work.

Continuing with this approach, override Current_Source$ and test to find that the source name and icon sync but volume controls still do not work. Take a deep dive into the framework and begin a wholesale rewrite of Room, or give up and proceed to the second use case.

(2) How can I use an input selection from a switcher to select a source on its associated room(s)?

Use the input feedback from the switcher driver to trigger a source selection on the [Source~] input slot of the room. For example, if the surround receiver is switcher 01, the room is 01, and the AirPlay source is 81:

X-01__Input_Is_AirPlay > Serial Send "\x50\x81" > R-01__Source~ > [Source~]

We do this all the time to turn on conference and presentation rooms based on video sync, like when a presenter plugs in a laptop.

patrickhampson commented 8 years ago

This worked perfectly! Thank you very much. I would love to see an explanation of how the other inputs can be used in the docs.

adelyte-austin commented 8 years ago

Crescendo Docs will cover this and other techniques. Thank you for raising the issue @patrickhampson!