Jump to content
The simFlight Network Forums

LVARS to Switch


Recommended Posts

Greetings to this great technical team


I'm trying to implement a switch to handle an LVAR variable. This switch is connected to a LEOBODNAR card. I obtained the variable from the FSUIPC7 list in this way:


ELECTRICAL_Switch_Battery_Master = 0.000000


I can see this because using the mouse to set the BATTERY MASTER switch to ON and then reloading the LVARS list the value has changed to:


ELECTRICAL_Switch_Battery_Master = 1.000000


Up to this point I have been able to know which variable I have to implement to place it in a macro. I have located the macro inside the FSUIPC7 folder and its name is:




And its content is:





When I move my LEOBODNAR card switch I can assign this macro to that plane panel switch. This tells me that so far I'm doing well. When I move my switch connected to LEOBONDAR card; the MASTER BATTERY on the plane's panel actually moves between the ON and OFF positions, BUT it does not do any function on the plane, that is, the plane's switch is in the ON position, but the panel does not represent that it is on. the switch moves between ON and OFF as if it had no power. If, on the other hand, I use the mouse by moving that switch on the airplane panel, in this case and only in this case, does it do what it is supposed to do, which is to make the battery power the panel. If I use my switch it does absolutely nothing; It's as if using my LEOBODNAR card switch, I made the plane's BATTERY MASTER switch move, but there was no battery. What am I doing wrong? Am I missing any steps in the programming or assignment?


I then decided to use an OPENCOCKPITS card that works switches. Inside the FSUIPC7.ini I wrote the following:





Then I made a program in SIOC with the following content:


Var 0001, Link FSUIPC_INOUT, Offset $66C0, Length 1

Var 0002, Link USB_ANALOGIC, Device 1, Input 1, PosL 0, PosC 127, PosR 255


  L0 = V0002

  IF L0 <> 255


    L1 = 0


  IF L0 = 255


    L1 = 1


V0001 = L1



The result is the same, the reading of the 66C0 variable shows me a 1 for ON and a 0 for OFF, the MASTER BATTERY SWITCH moves, but does not act on the plane. If I use the mouse on the MASTER BATTERY SWITCH, it does power the airplane panel and shows me that the 66C0 variable changes from 1 to 0.

Any help you can give me I would appreciate it.

Link to comment
Share on other sites

Then it looks like that lvar is only controlling the visuals. You have to determine what the aircraft actually dows when you move the switch in the VC, and then implement that in your assignments. This post shows you how to do this: https://www.badcasserole.com/uncovering-input-events-using-the-msfs2020-model-behavior-dialog/

However, someone else may already have done this, so it is always a good idea to check the MobiFlight HubHop site for available presets. You don't say which aircraft you are using (which is ALWAYS needed  for assignment issues), but searching the HubHop site for the lvar ELECTRICAL_Switch_Battery_Master, I can only see this in the Flysimware Cessna 414a, and there is the preset C414A_Master_Battery_Toggle to control this which uses the following calculator code:

(L:ELECTRICAL_Switch_Battery_Master,Bool) ! (>L:ELECTRICAL_Switch_Battery_Master,Bool) 
(L:ELECTRICAL_Switch_Battery_Master,Bool) 0 == (A:BUS CONNECTION ON:6,Bool) 1 == and 
(L:ELECTRICAL_Switch_Battery_Master,Bool) 1 == (A:BUS CONNECTION ON:6,Bool) 0 == and 
(L:ELECTRICAL_Switch_Battery_Master,Bool) 1 == (L:MASTER_BAR,Bool) 0 == and 
if{ 1 (>L:MASTER_BAR,Bool) }

So, if using the C414A try that. Alternatively, you could try searching for a similar preset for the aircraft you are using and look at the code for that to see what it is doing.

You can also try listing the available Input Events - there maybe one available that directly controls the master battery.

If you let me know what aircraft you are using, and I have access to this aircraft, I can look into this further for you. If I don't have this aircraft, I can only point you to things to try (as above).

Link to comment
Share on other sites

Thanks for your kind reply.

Indeed the plane is a Cessna 414 developed by the Flysimware company.

I am designing an engine ignition panel.

If you wish, I can send you the airplane installer.

Link to comment
Share on other sites

7 minutes ago, P-38L said:

If you wish, I can send you the airplane installer.

Sorry, but why would I need that? This is a payware aircraft, no? And I do not have al license for this....

8 minutes ago, P-38L said:

Indeed the plane is a Cessna 414 developed by the Flysimware company.

Then why not just use the presets available? As you can see for the calculator code of that preset, you need to do more than just change the lvar value...


Link to comment
Share on other sites

I have tried and I have not succeeded.

I used the step by step on the website that you suggested. I got to Step 5: Putting the event to use.

I also tried to place the programming that you sent me using the Developer mode of Flight Simulator. So I don't know where to locate the programming that you have sent me.

Also on the website


Indeed, Flysimware and the plane do appear. Mr. Jaime Leon offers the codes as well as the programming (the same one that you sent me), but I still don't know where or how to put that programming.

I apologize for all this inconvenience, but I have not been able to achieve it.

Link to comment
Share on other sites

13 hours ago, P-38L said:

I used the step by step on the website that you suggested. I got to Step 5: Putting the event to use.

That website shows how you inspect the aircraft code to aid in developing presets or to figure out how to make the assignment, As a preset already exists, you do not need to do this.

What you need to do is assign your button to that preset. In the button assignments window, press your button, then check 'Select for Preset', click the Find Preset... button, then select the preset that you want to use. It should be pretty straightforward....

Link to comment
Share on other sites

Dear Mr. Dowson.

I am very grateful for your magnificent help. Thanks to your advice I was able to achieve it.

I am going to perfect the method of using LVARS through MobiFlight.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.