One_Shot2011 Posted October 15, 2015 Report Posted October 15, 2015 Greetings Pete, I hope this is the correct area of your forum to ask this. My head has been spinning the last few weeks trying to search for the answer (I'm seriously lacking in programming knowledge), with no luck so far... and I figured you would know the answer. I have an Opencockpits Mastercard, which I'm sure you know deals with SIOC. I've been able to figure out how to get a simple command of, say the parking brake, to connect to one of my Korry switches. The bottom LED is on when the switch is off (brakes off) and when the switch is in/on the top LED turns on. That's all well and fine, as there is the FSUIPC_INOUT, Offset $0BC8, Length 2... portion of the coding. Where I have an issue with is getting commands from LUA into that type of code. As an example, the LINDA software offers about 90% of the switch actions for the Majestic Simulations Q400. Using my Korry switch which is for the Left Engine Intake door with a Leo-Bodnar card as a joystick, I can set the switch to that door as either Open or Closed, but the LEDs don't work.. hence me doing it with SIOC. The only thing is that I can't figure out where or how to get the information from LINDA into SIOC. Here's the LUA lines from LINDA regarding the door, and also the SIOC I used for the parking brake, which you can see I put the offset in bold, if that helps... If you can help, it would be greatly appreciated! -Thanks, Jack function ICE_EngIntake_L_open () ipc.writeLvar("MJC_VAR_WRITE_VALUE", 1) ipc.writeLvar("MJC_VAR_WRITE_CODE", 70232) DspShow ("IntL", "open") end function ICE_EngIntake_L_close () ipc.writeLvar("MJC_VAR_WRITE_VALUE", 0) ipc.writeLvar("MJC_VAR_WRITE_CODE", 70232) DspShow ("IntL", "clse") end Var 0400, Value 0 // Inicialización / Var init Var 0001, Link FSUIPC_INOUT, Offset $0BC8, Length 2 // Var 0002, Link IOCARD_SW, Input 2 Type I // { IF V0002 = 1 { V0001 = 32767 V0003 = 0 V0004 = DELAY 1 700 } ELSE { V0001 = 0 V0003 = DELAY 1 700 V0004 = 0 } } Var 0003, Link IOCARD_OUT, Output 11 Var 0004, Link IOCARD_OUT, Output 12
Pete Dowson Posted October 15, 2015 Report Posted October 15, 2015 Greetings Pete, I hope this is the correct area of your forum to ask this. My head has been spinning the last few weeks trying to search for the answer (I'm seriously lacking in programming knowledge), with no luck so far... and I figured you would know the answer. I have an Opencockpits Mastercard, which I'm sure you know deals with SIOC. I've been able to figure out how to get a simple command of, say the parking brake, to connect to one of my Korry switches. The bottom LED is on when the switch is off (brakes off) and when the switch is in/on the top LED turns on. That's all well and fine, as there is the FSUIPC_INOUT, Offset $0BC8, Length 2... portion of the coding. Where I have an issue with is getting commands from LUA into that type of code. As an example, the LINDA software offers about 90% of the switch actions for the Majestic Simulations Q400. Using my Korry switch which is for the Left Engine Intake door with a Leo-Bodnar card as a joystick, I can set the switch to that door as either Open or Closed, but the LEDs don't work.. hence me doing it with SIOC. The only thing is that I can't figure out where or how to get the information from LINDA into SIOC. Here's the LUA lines from LINDA regarding the door, and also the SIOC I used for the parking brake, which you can see I put the offset in bold, if that helps... If you can help, it would be greatly appreciated! I'm afraid I don't know anything about SIOC at all (nor LINDA, for that matter). So the lines of parameters for SIOC are just gibberish to me. For the standard FS parking brake you either need to use the controls, as assigned normally in Fs or in FSUIPC to buttons or switches, or you need to write to the Parking Brake offset (in the latter case, FSUIPC sends the controls for you). You have the correct offset 0BC8 and I assume you are writing the correct values -- a 16-bit (2 byte) word of 0 for off and 32767 (hex 7FFF) for on? But you should check that this is indeed happening by Monitoring the offset, as type U16, using the Monitoring facilities in the Logging Tab (right-hand side). If you are writing them correctly but it isn't working in the add-on aircraft you are using check again with a default aircraft. Maybe the creators of that add-on have done their own thing. If you are not getting the values written, then I'm afraid you need to talk to someone who knows about SIOC. If they are being written but then being overwritten, you have some conflicting setting or driver. Pete
One_Shot2011 Posted October 15, 2015 Author Report Posted October 15, 2015 Thanks for the reply Pete... a lot faster than I thought with your busy schedule. The values (correct word?) are correct for the parking brake in my example from SIOC as all seems to work fine in that regards. I'm hoping that I can somehow change it so that instead of it being the Parking Brake (0BC8) I can use something from the LUA to correlate with the switch in the Q400 - ipc.writeLvar("MJC_VAR_WRITE_CODE", 70232) - something from that. As you see by V0001 = 32767 which is the parking brake output ( Parking brake: 0=off, 32767=on ), is there a way to take the Lvar 70232 to input it somehow into an offset like the way the others are working, or am I way off here? I know that I can make a mouse macro for each and every switch in the Q400 cockpit, but not sure how I can then make that into an offset... When clicking on the button for the Left Engine Intake Door, it shows a function of RX87820*X55cc. I also know that if connecting a joystick, I can then put that to a button or switch. The issue is that the Opencockpits cards are not joystick cards, and need the FSUIPC offset. Once again, my head is spinning. I'll try contacting the LINDA support team to see if they can help, but I know they are no where near as quick to respond as you are. Many Thanks, Jack
Pete Dowson Posted October 15, 2015 Report Posted October 15, 2015 The values (correct word?) are correct for the parking brake in my example from SIOC as all seems to work fine in that regards. I'm hoping that I can somehow change it so that instead of it being the Parking Brake (0BC8) I can use something from the LUA to correlate with the switch in the Q400 - ipc.writeLvar("MJC_VAR_WRITE_CODE", 70232) - something from that. As you see by V0001 = 32767 which is the parking brake output ( Parking brake: 0=off, 32767=on ), is there a way to take the Lvar 70232 to input it somehow into an offset like the way the others are working, or am I way off here? Sorry, I'm not sure I understand. Are you saying that offset 0BC8 is changing correctly, but this does not operate your add-on aircraft's parking brake? If the add-on PB is only controlled via L:Var, then all you need is a little Lua plug in which has an event.offset for the offset 0BC8 calling a function which does the appropriate L:Var write. But your statement "take the Lvar 70232 to input it somehow into an offset " sounds as if you want to READ an LVar and copy it to an offset? I don't understand that bit as it doesn't seem to be right for a parking brake. Or is that just to control the LED? If so of course you can have an event on the L:Var, and write to an offset. Pete
One_Shot2011 Posted October 15, 2015 Author Report Posted October 15, 2015 I think my head spinning got the information screwed up. The parking brake and 0BC8 works fine, and was only an example of how I can get it to work with SIOC. Ignoring the Brake and 0BC8 from now on, I can make SIOC read a switch and make an LED interact with it. What I'm trying to do is to get that command (switch position = 1 or 0) and have FSX respond. In the default FSX commands, I can do that, but what about a custom switch or button? If you look at the picture from the Sim that I attached, I'm trying to control the two Korry switches. The left switch is "in", and the right switch is "Out". I can make SIOC change the LED state depending on how I have the switch, but getting the information from the sim, or sending the switch position to the sim is another story. If I use any other joystick type interface card, I can get the switches to work from mouse macros, but trying to get that information into SIOC for the use with my Opencockpits interface is something I'm really struggling with. Thanks again for your time.
Pete Dowson Posted October 15, 2015 Report Posted October 15, 2015 Ignoring the Brake and 0BC8 from now on, I can make SIOC read a switch and make an LED interact with it. What I'm trying to do is to get that command (switch position = 1 or 0) and have FSX respond. In the default FSX commands, I can do that, but what about a custom switch or button? "Custom" switches and buttons? Sorry, that sounds like you mean ones specifically for you and not related to a specific aircraft. If you really mean switches particular to the Add-On aircraft you are using, then you need to find a way to set them, whether it be by custom controls (as used by PMDG), L:Vars or mouse Macros. Or even keyboard shortcuts -- lots of add-ons spport those. If none of those facilities are supported by your add-on aircraft then you are out of luck. If you look at the picture from the Sim that I attached, I'm trying to control the two Korry switches. The left switch is "in", and the right switch is "Out". I can make SIOC change the LED state depending on how I have the switch, but getting the information from the sim, or sending the switch position to the sim is another story. The picture doesn't help at all. sorry. Is it your hardware or a screen grab from the add-on? Why not just set the AddOn switches according to your hardware switches? Are you also trying to control your hardware from switches in the Addon? You were using L:Vars earlier. Are you now saying they aren't actually available? If there's no way of controlling the add-on switches or getting their states out, then I think you may need to choose a different add-on, unless the makers will add stuff for you. If I use any other joystick type interface card, I can get the switches to work from mouse macros, but trying to get that information into SIOC for the use with my Opencockpits interface is something I'm really struggling with. Er, mouse macros cannot get information OUT of the Sim! They operate like clicking the mouse, there's no way to read what the mouse does! If you mean the only way to operate the add-on switches is by mouse macors then you need to program SIOC to execute the mouse macros. If SIOC can send character strings to offsets then there's an offset to do that. If not you'd need a Lua plug-in to do it for you, based on values sent by SIOC to a user iffset (any in the range 66C0 to 66FF). Pete
One_Shot2011 Posted October 16, 2015 Author Report Posted October 16, 2015 Hey Pete, I tried working through your answers to see if I could solve my issue. I think I've come up with a slight solution, but I'm still having a problem. First off though, the Parking Brake works. It was only an example to SIOC. The picture is from within FSX and shows which switch in the Q400 I'm try to work with. In using the following code, I can get a button press out of FSUIPC in the buttons and switches. Where I'm having an issue though is getting the switch to turn off. "Var 1 Link IOCARD_SW Input 2 Type I { &FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64 } Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4" I realize that this works like any other toggle switch, but do you know if there's a way to select the "off" of the switch using the above code? I was assuming that the changebit 0, if set to 1, would work... but it doesn't. If I can figure out how to get the button to turn off, I think I'm on the right track. Again, the above code is read by FSUIPC as a switch (Joy#64, Btn#0) in the "on" position, but what can I use for the "Off" position of the switch? Hope that makes sense. Jack
One_Shot2011 Posted October 16, 2015 Author Report Posted October 16, 2015 Pete, nevermind. I'm having a different issue, which until I can figure it out, it doesn't make sense to try and figure out the above. I tried with an on/off/on switch, but can't get the button (in the sim) to work in both directions. It presses in, but I can't get it back out. If I make any headway on my problem, I'll let you know. Jack
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now