Home AMX User Forum NetLinx Studio

Switching Video modes

What kind of command would I use to switch Video modes, video to s-video back to video using the same button. I have try the below code but it stays in S-video mode. It will go from Video to S-video but remain there inless I go to RGB and start over.

IF (!Video_Input)
{
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1012',13"
SEND_STRING 0, "'%A1012',13"
Off [RGB_Input]
On [Video_Input]
}
Else IF(Video_Input)
{
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1014',13"
SEND_STRING 0, "'%A1014',13"
On[Video_Input]
Off [RGB_Input]
}
Else IF(Video_Input)
{
send_string dvPlasma,"'@G',13"
wait 20 send_string dvPlasma,"'%A1012',13"
SEND_STRING 0, "'%A1012',13"
On[Video_Input]
Off [RGB_Input]
}

}

Comments

  • mpullinmpullin Posts: 949
    The third block of the code segment will never, ever execute. Essentially, you have

    IF ( NOT A ) { }
    ELSE IF ( A ) { }
    ELSE IF ( A ) { }

    I'm not 100% sure what you're trying to do or what all those variables are for, but you should rethink your logic.
  • David_wDavid_w Posts: 23
    Basiclly I am trying to go:

    Button press 1:
    Goes to Video mode

    Button Press 2
    Goes to S-Video mode

    Button Press 3
    Goes back to Video mode.

    and the cycle repeats every time I hit the button.
  • pauldpauld Posts: 106
    David_w wrote:
    What kind of command would I use to switch Video modes, video to s-video back to video using the same button. I have try the below code but it stays in S-video mode. It will go from Video to S-video but remain there inless I go to RGB and start over.

    IF (!Video_Input)
    {
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1012',13"
    SEND_STRING 0, "'%A1012',13"
    Off [RGB_Input]
    On [Video_Input]
    }
    Else IF(Video_Input)
    {
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1014',13"
    SEND_STRING 0, "'%A1014',13"
    On[Video_Input]
    Off [RGB_Input]
    }
    Else IF(Video_Input)
    {
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1012',13"
    SEND_STRING 0, "'%A1012',13"
    On[Video_Input]
    Off [RGB_Input]
    }

    }

    You are using "Video_Input" as a test. You are turning it on, but not off. So the code block for Video will run only the first time, but not after. You need to change "Video_Input" to off when you are going to S-Video. Also as mpullin says, you don't need the last block of code.
  • David_wDavid_w Posts: 23
    Hey thank you that worked out fine.
  • mpullinmpullin Posts: 949
    Oh, so that's what's going on. In that case, you don't need the RGB_Input variable at all. No need to use two stones to kill one bird :p
  • David_wDavid_w Posts: 23
    Say I had to do the same thing with RGB but there were 3 RGB sources. Would I then need to write a switch case on/off for that. RGB 1, RGB 2, and RGB 3 and cycle back through.
  • mpullinmpullin Posts: 949
    David_w wrote:
    Say I had to do the same thing with RGB but there were 3 RGB sources. Would I then need to write a switch case on/off for that. RGB 1, RGB 2, and RGB 3 and cycle back through.
    It would be more efficient by far to have one variable to hold the current source, and put 1 in the variable when it the input was RGB1, 2 when the input was RGB2, etc. You would then be able to use switch/case:
    switch(nRGB_VAL){
         case 1:
              // set input to RGB2
              nRGB_VAL = 2
         break
         case 2:
              // set input to RGB3
              nRGB_VAL = 3
         break
         case 3:
              // set input to RGB1
              nRGB_VAL = 1
         break
         default:
              nRGB_VAL = 1 // so it doesn't get stuck
         break
    }
    
  • David_wDavid_w Posts: 23
    Nrgb_val

    Hey, I am really confused on where the nRGB_Val 1,2,3 are set at. I dont understand how do define it. I believe it to be a Variable because it would change cause of RS-232 codes that need to be sent. Is that correct? Are the cases going to look like this:

    switch(nRGB_VAL)
    {
    case 1:
    // set input to RGB2
    {
    nRGB_VAL = 2
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1000',13"
    SEND_STRING 0, "'%A1000',13"
    On [RGB_Input]
    break
    }
    case 2:
    // set input to RGB3
    {
    nRGB_VAL = 3
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1001',13"
    SEND_STRING 0, "'%A1001',13"
    On [RGB_Input]
    break
    }
    case 3:
    // set input to RGB1
    {
    nRGB_VAL = 1
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1002',13"
    SEND_STRING 0, "'%A1002',13"
    On [RGB_Input]
    break
    }
    default:
    {
    nRGB_VAL = 1 // so it doesn't get stuck
    send_string dvPlasma,"'@G',13"
    wait 20 send_string dvPlasma,"'%A1000',13"
    SEND_STRING 0, "'%A1000',13"
    off [RGB_Input]
    break
    }
    }
  • David_wDavid_w Posts: 23
    Thanks

    Hey it works, Thank you so much... I figured something out with help of course. Thanks again.
Sign In or Register to comment.