|
|
 |
|
The following page was printed from RemoteCentral.com:
|
Newbie needs If/then/Else programming...
| |
|
| Topic: | Newbie needs If/then/Else programming advice with 980 This thread has 10 replies. Displaying all posts. |
|
| Post 1 made on Monday January 10, 2011 at 18:57 |
storman Long Time Member |
Joined: Posts: | December 2010 16 |
|
|
I'm a newbie to the 980 and programming macros using If/then/Else statements and variable checking. I'd like to see if I've got this right or at least somewhere in the ballpark. Equipment: Sony Projector Cable decoder AVR Bluray MRF350 MFR260
Situation: Let's say I've just finished watching something in my Bluray player and now I want to watch the evening news on cable. That means the Projector and AVR needs to be left on, the Bluray player can be turned off and the cable box needs to be turned on. All devices have discrete on/off codes making that part of programming the macro a bit easier.
Macro, Watch Cable TV: If (projector_ON) true then switch proj input HDMI2 then power on cable If (AVR_ON) true then switch AVR input to DBS/Sat then Jump to Cable TV Else then power on AVR then switch AVR input to DBS/Sat then Jump to Cable TV set var AVR_ON true Else then power on projector wait 30 sec then switch proj input to HDMI2 set var Proj_ON true (repeat of the nested If statement that checks if AVR is on and if not the turns it on)
Does this sound about right or did I make it too complicated ? Of course, this still has to work if all the components are off, so I figured no assumptions about power on/off status. (I did deliberately leave out checking the on/off status of the cable box and powering off the Bluray player for the moment.)
One question: should the Else statement have a variable statement like the If ? I've double-clicked on it but it brings up the If box. Any choices I make there, like AVR_ON = False resets my If statement to False instead.
One other question: testing the macros. Does the test button mean that if the 980 is tethered to my laptop it will run the macro with the remote firing off the IR codes to all the devices much like the very simple testing of device on and off codes in earlier steps in CCP ? That would save some time having to wait to download each time a change has to be made.
Thanks much, Bill
|
|
| Post 2 made on Monday January 10, 2011 at 22:13 |
KVH Advanced Member |
Joined: Posts: | December 2006 911 |
|
|
To make it easy on you..... just turn off the bluray when you turn off the system. I never turn off compents while the system is in use. Now you can track the power state of the bluray and only issue the "off" command if needed.
If you have discrete commands for the Proj or the rcvr.... no need for an if/else. Just track power (to skip turn on delays) if already on.
What are the model numbers of the gear you have?
I don't like long macros unless they have to be.
|
All high's, all low's, it must be....... Einstein @ URC Control Room forum www.einsteinaudiosystems.com |
|
| Post 3 made on Tuesday January 11, 2011 at 10:06 |
kgossen Super Member |
Joined: Posts: | March 2008 3,026 |
|
|
Agreed too long. Will you ever have the projector on without the AVR? The simpler you make it, the better it will work and much easier to troubleshoot.
It may be a pain but always download and test. What works with the simulator often doesn't work on the remote!
|
"Quality isn't expensive, it's Priceless!" |
|
| OP | Post 4 made on Tuesday January 11, 2011 at 18:03 |
storman Long Time Member |
Joined: Posts: | December 2010 16 |
|
|
On January 10, 2011 at 22:13, KVH said...
To make it easy on you..... just turn off the bluray when you turn off the system. I never turn off compents while the system is in use. Now you can track the power state of the bluray and only issue the "off" command if needed.
If you have discrete commands for the Proj or the rcvr.... no need for an if/else. Just track power (to skip turn on delays) if already on.
What are the model numbers of the gear you have?
I don't like long macros unless they have to be. Agreed - I don't like long macros either. As the typing increases, so do the chances for errors. I realize that with discrete on/off commands the logic is easier. However, with long turn on delays needed for a projector and my Pioneer Bluray player, I'm looking for ways to skip the delays if those devices are already on. I think I might have seen ways to track the power state through variables, (I don't have a MSC 400) but I don't think I grasp how that works. The programming manual touched on it, I think, but I don't comprehend how it works. Can you give example of how to track the power status in a 980 macro without resorting to if/then/else and explain why it works that way ? Thanks, Bill
|
|
| OP | Post 5 made on Tuesday January 11, 2011 at 18:13 |
storman Long Time Member |
Joined: Posts: | December 2010 16 |
|
|
On January 11, 2011 at 10:06, kgossen said...
Agreed too long. Will you ever have the projector on without the AVR? Sure, the projector will always be used with the AVR, but I figured this activity macro has to be written to cover both possibilities where either it is used when switching from another activity or from a cold start. Therefore I believe should be checking whether each device is on, and if not, then issue the power on command for those devices that aren't. So how should it be trimmed down to accomplish the same thing ? Besides increasing complexity and the chances for errors, I'm sure long macros are wasting finite memory resources on my 980. Bill
|
|
| Post 6 made on Tuesday January 11, 2011 at 18:48 |
KVH Advanced Member |
Joined: Posts: | December 2006 911 |
|
|
What are the model numbers of the equipment you have? To move further that info is needed so we know if you have discrete codes for power, inputs, etc.
|
All high's, all low's, it must be....... Einstein @ URC Control Room forum www.einsteinaudiosystems.com |
|
| Post 7 made on Tuesday January 11, 2011 at 23:52 |
Palnews26 Long Time Member |
Joined: Posts: | April 2009 490 |
|
|
Just put a Bluray Off command at the beginning of your Watch TV "Power On"commands. Sending your discrete power on commands to something that is all ready on won't do anything. I don't think you need a If/Else for this.
Watch Bluray Cable Box Off Projector On AVR ON Bluray Player On Input xxx
Watch TV Cable Box On Bluray Off (If it's all ready off nothing will happen) If it's on, it goes off. Projector On (if it's on it will stay on) AVR On (same) Input xxx
This is kind of a quick version. It also works in reverse. I'm sure you can work this out for your situation.
|
|
|
| Post 8 made on Wednesday January 12, 2011 at 03:11 |
mistachy Long Time Member |
Joined: Posts: | April 2010 269 |
|
|
bill i can sen you my file if your interested, it will give you many ideas. mine is more complicated than yours.
i have some youtube videos that demonstrate it.
|
MX6000 :o) myfile [Link: texas-rebel.com]LR: Onkyo TX-NR807, Samsung 52", MRX-1. BR1: LG 37", Sony AVR, MRF-260. BR2: MarantzSR8002, Epson8500 100", Klipsch RF-82 HT System, MSC400, HTPC |
|
| OP | Post 9 made on Wednesday January 12, 2011 at 08:31 |
storman Long Time Member |
Joined: Posts: | December 2010 16 |
|
|
Thanks everyone. Yes, my devices have discrete codes for on/off, input selection, and so on. So, yes, I have made a few simple, direct power on macros for my activities. However, because the projector and bluray player have long start up times, delays and proper sequencing have to built into each power on macro that uses them. Things like switching inputs will be missed if done out of order or if delay times are not respected. My end game is I want to be able to switch between activities without having to wait for those long start up times for devices that may already be on from a previous activity.
This would be a no-brainer creating activity start up macros if all the equipment had short start-up times and discrete codes. That would be real simple coding that even a Geico cave man could do.
To answer those who asked for specific devices, I have - Sony VPL VW50 projector Denon AVR 5803 (no hdmi inputs/outputs) Pio BDP 51FD Motorola DCH3200 HD cable box (hdmi output) Tosh A2 HD-DVD player
I do not use an HDMI switcher at this time, so the BDP is connected directly to the HDMI 1 input on the projector, and the cable box directly to HDMI 2. For setup of the Denon (which can only be done on-screen) I have a composite cable connected to the Sony's Video 1 input. If and when I choose to play a HD-DVD movie on the Toshiba, I disconnect the HDMI cable from the cable box and into the Tosh. Kludgey, yes, but getting my CFO to approve any other large purchases (new receiver with full 1080p hdmi pass-thru switching, audessey multi- EQ, etc) is pretty tough these days, so I work with what I have.
So for watching activities there have to be commands to switch the inputs on the projector and they have to be sequenced properly after a sufficient amount time, usually 50 seconds, after the projector power on command. That's the prime reason why I'd like to check the projector power (and other devices) state so that I could skip the 50 second delay if the device is already on.
I hope that makes my situation a little clearer for all you very helpful people out there.
Thanks, Billl
|
|
| Post 10 made on Wednesday January 12, 2011 at 09:35 |
kgossen Super Member |
Joined: Posts: | March 2008 3,026 |
|
|
On January 11, 2011 at 23:52, Palnews26 said...
Just put a Bluray Off command at the beginning of your Watch TV "Power On"commands. Sending your discrete power on commands to something that is all ready on won't do anything. I don't think you need a If/Else for this.
Watch Bluray Cable Box Off Projector On AVR ON Bluray Player On Input xxx
Watch TV Cable Box On Bluray Off (If it's all ready off nothing will happen) If it's on, it goes off. Projector On (if it's on it will stay on) AVR On (same) Input xxx
This is kind of a quick version. It also works in reverse. I'm sure you can work this out for your situation. This is great as long as you don't mind waiting the 30 seconds every time you switch activities. The reason for the IF/ELSE is if the projector is on, switch to next activity without waiting for projector to warm up. IF/ELSE are used for much much more than just product with out discretes.
|
"Quality isn't expensive, it's Priceless!" |
|
| Post 11 made on Wednesday January 12, 2011 at 10:23 |
Palnews26 Long Time Member |
Joined: Posts: | April 2009 490 |
|
|
I missed the 30sec delay part. Create a variable called Projector Power ON. It's either True/On or False/Off Put the If/Else for the projector at the beginning so if its off it will turn on first. If Variable Projector Power On is True, do this, this, and this. Else, Variable Projector Power On is False do this, this. and this. You can do the same for the Bluray if you wish. Don't forget to add the Variable statement True or False at the end of your macros to keep track. In my example the commands were not in any particular order. Find the proper order that suits your equipment. Don't try to think about all scenarios at once. Just start small and add more as you figure out the flaws. I use a lot of these for my second zone to avoid shutting off equipment that's being used else where at the time.
|
|
|
 |
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|