PDA

View Full Version : SIOC script for ap/at/fmc reset help..?



AndyCYXU
01-25-2013, 05:13 PM
Hi, so I am making this script to make my AP/AT/FMC work with PMDG737.. yes I know PMDG IS NOT GOOD FOR HOMECOCKPIT but still I wanted to try and see if any one can help me here... ?

Switches to RESET work fine problem is with LEDS only the DUAL LEDS that are fo AP and AT reset red/yellow; FMC works just fine and all others work fine if i use only 1 LED but i was being ambitious so i made switch with both yellow and red LEDS.. now how do i make them work correctly.. ?

The lower part of script is the actual switches to reset they work fine problem is with LEDS


//APATFMC

//var 3000 name AP_YEL_LED Link IOCARD_OUT Device 4 Output 14
//var 3001 name AP_RED_LED Link IOCARD_OUT Device 4 Output 16
var 3002 name AT_YEL_LED Link IOCARD_OUT Device 4 Output 12
var 3003 name AT_RED_LED Link IOCARD_OUT Device 4 Output 20
var 3004 name FMC_YEL_LED Link IOCARD_OUT Device 4 Output 18

var 4000 name AT LINK FSUIPC_IN Offset $6552 Length 1
{
IF &AT = 2
{
&AT_YEL_LED = 0
&AT_RED_LED = 0
}


IF &AT = 1
{
&AT_YEL_LED = 1
&AT_RED_LED = 0
}
ELSE
{
&AT_YEL_LED = 0
&AT_RED_LED = 1 // IF IS SET THIS TO '0' THEY ALL BEHAVE CORRECTLY BUT AGAIN ONLY YELLOW LED
}
}



var 4002 name FMC LINK FSUIPC_IN Offset $6554 Length 2
{
IF &FMC = 0
{
&FMC_YEL_LED = 0
}

ELSE
{
&FMC_YEL_LED = 1
}
}





Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4

//AP AT FMC RESET BUTTONS
//FSUIPC BASE
//AP 69971
//AT 69972
//FMC 69973

Var 20 Link IOCARD_SW device 4 Input 21 Type I
{
&FO_JoyStick64 = CHANGEBIT 17 v20 // AP RESET
}

Var 21 Link IOCARD_SW device 4 Input 25 Type I
{
&FO_JoyStick64 = CHANGEBIT 18 v21 // AT RESET
}

Var 22 Link IOCARD_SW device 4 Input 24 Type I
{
&FO_JoyStick64 = CHANGEBIT 19 v22 // FMC RESET
}





I AM ONLY TALKING ABOUT 1 SWITCH HERE, I AM SURE THE SECOND WILL BEHAVE THE SAME
AUTO THROTTLE WARNING
To make it easy with this script I just test the AT Reset


what happens with this script used is:


RED LED is ALWAYS ON when all should be OFF
when i use TEST UP (YELLOW light) or TEST DOWN (RED Light) red goes OFF yellow goes ON both tests
when i actually disengage AT (RED BLINKING LIGHT) i get the yellow and red blink on/off but not together they cycle redON YellowOFF then redON YellowON and so on...


I think there is something with the valuse I assigned to variable AT but idk..
IF I set red led to 0 kinda removing it from equation totally it works fine but again I only get yellow leds working

I keep on trying if someone feels like taking a shot at it I will appriciate your help

Andy

kiek
01-26-2013, 11:57 AM
Hi
I am no 737 expert, but at least this part of your SIOC script is ambiguous:


IF &AT = 2
{
&AT_YEL_LED = 0
&AT_RED_LED = 0
}


IF &AT = 1
{
&AT_YEL_LED = 1
&AT_RED_LED = 0
}
ELSE
{
&AT_YEL_LED = 0
&AT_RED_LED = 1 // IF IS SET THIS TO '0' THEY ALL BEHAVE CORRECTLY BUT AGAIN ONLY YELLOW LED
}


While:
if AT = 2 you first set AT_RED_LED to 0 while in the next IF statement it is set to 1 ??

regards,
Nico

AndyCYXU
01-26-2013, 09:24 PM
OK maybe i explain my thinking here...
I was hoping that this AT offset would have 3 states OFF/YELLOW LIGHT WARNING/RED LIGHT WARNING



//FIRST PART
{
IF &AT = 0 //IN OP IT IS SET TO =2 I JUST TRIED SOME OTHER VALUE BUT IT DOESN'T CHANGE ANYTHING 0 OR 2
{
&AT_YEL_LED = 0
&AT_RED_LED = 0
}
//SECOND PART
IF &AT = 1 //SO SOME OTHER STATE I WAS HOPING YELLOW LIGHT STATE
{
&AT_YEL_LED = 1
&AT_RED_LED = 0
}
//THIRD PART
ELSE //SOMETHING ELSE THEN 0 OR 1 I WAS HOPING FOR RED LIGHT STATE
{
&AT_YEL_LED = 0
&AT_RED_LED = 1 //AGAIN WHEN SET TO =0 BECOMES PRETTY MUCH SAME CODE AS BELOW
}

TO COMPARE This simple code BELOW works perfect but only yellow LED, YELLOW is used and it works for both RED and YELLOW
for example when:
AT disconnected:
IN FSX RED LIGHT BLINKING
IN MY HOMECOCKPIT YELLOW LIGHT BLINKING
Test Lights
IN FSX RED LIGHT ON
IN MY HOMECOCKPIT YELLOW LIGHT ON
2nd Test lights
IN FSX YELLOW LIGHT ON
IN MY HOMECOCKPIT YELLOW LIGHT ON



{
IF &AT = 0
{
&AT_YEL_LED = 0

}


ELSE
{
&AT_YEL_LED = 1

}

}


so maybe I am wrong in assuming that pmdg does write some "third value" to FSUIPC that says RED Light should be on...
I was looking around and it seems there is a program for Ifly737 called IflytoFSUIPC well looks like my PMDG just might go to the junk yard... will fly it to the grave yard in Arizona... :roll: .

Andy

nolatron
01-26-2013, 11:29 PM
There's two offsets for each button, 1 for each color.

For the AP it's offset 6550 and 6551. The offsets only have two values. 0=off and 1=on.

AT is 6552 and 6553 and FMC is 6554 and 6555.

AndyCYXU
01-27-2013, 01:08 PM
Thanks Shaun, but no it doesn't work :(
You are correct there is offset 6551,6553 "not listed in the offsef file:roll:", not sure about 6555 probably so FMC only has yellow light, but... they might be for FO AP/AT/FMC reset, and they are not "as far as my testing goes" for Yellow/Red warning.
I tried that:

var 3002 name AT_YEL_LED Link IOCARD_OUT Device 4 Output 12
var 3003 name AT_RED_LED Link IOCARD_OUT Device 4 Output 20
var 3004 name FMC_YEL_LED Link IOCARD_OUT Device 4 Output 18

var 4000 name AT LINK FSUIPC_IN Offset $6552 Length 2 //also tried Length 1 (doesn't change anything)
{
IF &AT = 0
{
&AT_YEL_LED = 0

}


ELSE
{
&AT_YEL_LED = 1

}

}

var 4001 name ATR LINK FSUIPC_IN Offset $6553 Length 2
{
IF &ATR = 0
{
&AT_RED_LED = 0

}


ELSE
{
&AT_RED_LED = 1

}

}
Basically what happens is both lights RED and YELLOW go on.

It could be I am testing it wrong... but idk... I'm in parked AC basically i turn off AT on MCP and in FSX red blinking warning comes on, then I use the test switch beside the 3 warnings, DOWN (TEST#2) will test RED lights , moving it UP (TEST#1) will test YELLOW, using the offsets you gave me, both YELLOW and RED come ON each time that is why i think they are for FO side and not for color.. but maybe I'm doing something wrong idk...

I don't know why would there be separate offsets for Captain and FO, i suppose maybe on the real aircraft they are separate system just in case one side fails to worn the other will still work so one of the pilots will see the warning, not sure what the circumstances would be that only FO officers warning for AP or AT or FMC would come on, but that's not an issue here.

Well for now I just set it to work with RED I have enough Yellow ones it looks more pretty now :D with various colors...

Andy

nolatron
01-27-2013, 02:11 PM
Ah yeah, I didn't think if the two offsets could be 1 for Capt and 1 for F/O.

I just use the primary offset in the list with a single color LED for my MIP.

fordgt40
01-27-2013, 03:26 PM
Hi

You should not have two offsets sharing the same memory location, even though you say it does not change anything :)

var 4000 name AT LINK FSUIPC_IN Offset $6552 Length 2 //also tried Length 1 (doesn't change anything)


var 4001 name ATR LINK FSUIPC_IN Offset $6553 Length 2


Var 4001 should start at $6554 if var 4000 has a length of 2, or you change the length on each to 1

David

AndyCYXU
01-28-2013, 12:14 PM
Ok, I will give it a try honestly I wasn't sure what did this lenght statement meant I though if the offset file said BYTE | 2 | ... You were suppose to put length =2 well I will try using lenght 1 for both see if that makes the red led come on by itself

fordgt40
01-28-2013, 12:45 PM
Hi

If the offset documentation says it is 2 bytes, then that is what you use. However, you cannot then have offset memory addresses that are separated by only one byte. So either the stated length is wrong or the actual memory offset value is wrong :)

Have you tried using the IOCPConsole and log function to see what is happening when you run your script. That will tell you whether it is doing what you expect it to do. If not, then you should get some pointers as to what to change

David

AndyCYXU
01-28-2013, 02:40 PM
OK, so I tested with the IOCP Console and it seems it proves that the other offsets 6551,6553 and 6555 that Shaun "Nolatron" mentioned are for FO lights not for Yellow/Red and maybe codes for yellow/red are buried somewhere in c++ of the actual PMDG.. well that is way beyond my knowledge i just started to understand SIOC.
and as fordgt40 said.. well yes length 1 or 2 does actually change things :D in my final code i use length=2 so that if for some reason only FO warning comes ON for one of these lights in the actual Simulator, it will come ON on my side, when i make the second set of these switches then i edit this code to separate the two, but for now I just leave it as I can't figure out how to split light so at the moment only 1 LED can be used for the dual LED switches, maybe buying the switches from Flyengravity with their drivers makes them work wright but i made mine for total cost of $20-25 their cost 90 Euros :-P so i keep mine and it was fun making them too :)



Here is FINAL CODE if anyone is interested DEVICE/OUTPUT/INPUT numbers will have to be changed to match your hardware setup.
Device 4 = USBExpensionCard (MasterCard) (in my setup)
THIS CODE AND OFFSET VALUES ARE MEANT FOR PMDG737NGX


//APATFMC

var 3000 name AP_YEL_LED Link IOCARD_OUT Device 4 Output 14
var 3001 name AP_RED_LED Link IOCARD_OUT Device 4 Output 16
var 3002 name AT_YEL_LED Link IOCARD_OUT Device 4 Output 12
var 3003 name AT_RED_LED Link IOCARD_OUT Device 4 Output 20
var 3004 name FMC_YEL_LED Link IOCARD_OUT Device 4 Output 18

var 4000 name AP LINK FSUIPC_IN Offset $6550 Length 2
{
IF &AP = 0
{
&AP_RED_LED = 0

}


ELSE
{
&AP_RED_LED = 1

}

}

var 4001 name AT LINK FSUIPC_IN Offset $6552 Length 2
{
IF &AT = 0
{
&AT_RED_LED = 0

}


ELSE
{
&AT_RED_LED = 1

}

}

var 4002 name FMC LINK FSUIPC_IN Offset $6554 Length 2
{
IF &FMC = 0
{
&FMC_YEL_LED = 0
}

ELSE
{
&FMC_YEL_LED = 1
}
}

// FOLLOWING IS A CHEAT DOES NOTHING IN SIMULATOR BUT WILL MAKE THE TEST SWITCH WORK IN HARDWARE TO TEST BOTH RED AND YELLOW LEDS SEPARATELY EYE-CANDY FOR HOMECOCPIT

Var 1 name TEST_LIGHT1 Link IOCARD_SW DEVICE 4 INPUT 22 TYPE I
{
IF &TEST_LIGHT1 = 1
{
&AP_YEL_LED = 1
&AT_YEL_LED = 1
&FMC_YEL_LED = 1
}
ELSE
{
&AP_YEL_LED = 0
&AT_YEL_LED = 0
&FMC_YEL_LED = 0
}
}

Var 2 name TEST_LIGHT2 Link IOCARD_SW DEVICE 4 INPUT 19 TYPE I
{
IF &TEST_LIGHT2 = 1
{
&AP_RED_LED = 1
&AT_RED_LED = 1
&FMC_YEL_LED = 1
}
ELSE
{
&AP_RED_LED = 0
&AT_RED_LED = 0
&FMC_YEL_LED = 0
}
}

THIS PART CONTROLS THE ACTUAL SWITCH TO RESET WARNINGS and needs to be setup through FSUIPC after in Switches/buttons section
THIS CODE AND VALUES CUSTOM CONTROL BASE FOR FSUIPC ARE MEANT FOR PMDG737NGX




Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4

//-------------------------------------------------AP AT FMC RESET BUTTONS------------------------------------------

//AP AT FMC RESET BUTTONS
//FSUIPC BASE
//AP 69971
//AT 69972
//FMC 69973

Var 22 Link IOCARD_SW device 4 Input 21 Type I
{
&FO_JoyStick64 = CHANGEBIT 17 v22 // AP RESET
}

Var 23 Link IOCARD_SW device 4 Input 25 Type I
{
&FO_JoyStick64 = CHANGEBIT 18 v23 // AT RESET
}

Var 24 Link IOCARD_SW device 4 Input 24 Type I
{
&FO_JoyStick64 = CHANGEBIT 19 v24 // FMC RESET
}



Thanks for your help..
If anyone knows how to make the RED/YELLOW work don't be shy let me know... :D
Andy