Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I built a box to attach to my Cessna 172 (A2A) sim in P3D v5. I am using FSUIPC6.

It has the ignition, Master ALT, Master BAT, all the lights and pitot and the Avionics switches.

I created 6 macros to turn the Master ALT, Master BAT and Avionics switches ON and OFF.

Problem:

It works great as long as the switches on the sim are at the same position as the switches on the box.

If the switch on the sim is on a different position than the switch on the box, moving the switch on the box produces the opposite result.

For example:

If the Avionics switch on the sim and the box are in the same position, it works like a charm. 

If they are opposite in the sim and the box, they work in reverse: I flick the box Avionics OFF and it flicks the Avionics switch in the sim to ON and vice versa.

Is there a way to "synchronize" the position of the sim Avionics switch with the current position of the Avionics on the box?

Thanks

Posted

You posted in the User Contributions sub-form - I have moved your post to the main support forum.

12 hours ago, raynald1 said:

If they are opposite in the sim and the box, they work in reverse: I flick the box Avionics OFF and it flicks the Avionics switch in the sim to ON and vice versa.

The usual way to handle this is to use an offset condition on your assignments to check the current state of the switch in the sim (held in an offset) and only send the control if needed. See the Advanced User guide on adding offset conditions.

12 hours ago, raynald1 said:

Is there a way to "synchronize" the position of the sim Avionics switch with the current position of the Avionics on the box?

This is not possible as FSUIPC only acts on state changes (buttons, switches, axes), so there is no way to determine the initial state. However, if you use offset conditions, your switches will be syncronized after the first activation, if not already.

John

Posted

John

Thank you for your reply. I applied your instructions and it works great for the Master Battery but I am having difficulty finding the correct offsets for the other switches.

I am using the Cessna 172 with G 1000 from Carenado this time.

I used offset 281C for the Master Bat and it works great. (I found it in the Offset Status pdf)

However I could not find one for the Master ALT, and I used 3102 for the Avionics Bus 1 and 3103 for Bus 2 without success.

How can I search from inside the sim for the correct offset when I move a switch?

Thanks

Ray

Posted
12 hours ago, raynald1 said:

However I could not find one for the Master ALT,

That seems to be in offset 0x3101 - GENERAL ENG MASTER ALTERNATOR:1

12 hours ago, raynald1 said:

I used 3102 for the Avionics Bus 1 and 3103 for Bus 2 without success.

Avionics Bus 2 looks to be in offsets 0x2E80 and 0x3103 (AVIONICS MASTER SWITCH). There doesn't seem to be an offset for bus 1. However, looking at the MF presets for the C172 (https://hubhop.mobiflight.com/presets/):
    C_172_AVIONICS_BUS_1_ON: (A:CIRCUIT SWITCH ON:24, Bool) ! if{ 24 (>K:ELECTRICAL_CIRCUIT_TOGGLE) } 
(A:CIRCUIT SWITCH ON:24, Bool) 1 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:4, Bool) != if{ 4 1 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }
    C_172_AVIONICS_BUS_2_ON: (A:CIRCUIT SWITCH ON:25, Bool) ! if{ 25 (>K:ELECTRICAL_CIRCUIT_TOGGLE) } 
(A:CIRCUIT SWITCH ON:25, Bool) 2 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:5, Bool) != if{ 5 2 (>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE) }

This would indicate that the state of the avionics bus switches is held in  the simvars
    A:CIRCUIT SWITCH ON:24 for bus 1
    A:CIRCUIT SWITCH ON:25 for bus 2
These are currently not held in any FSUIPC offsets. You can add them yourself using the facilities to add any simvar to a free FSUIPC offset, described on page 34 of the Advanced User guide.

Generally, to find an offset that holds the state of a switch, you should first check the Offset status document to see if anything looks relevant, and then try logging that offset using FSUIPC's offset logging facilities. Then see if the value changes when you move the switch - you can keep the logging console open using the Log->Open Console menu option and you will see the logged offset value change, if it is being used.

If there are no offsets that look applicable, you should then look at the preset code that controls the switch (on the MF HubHob site referenced above). This should give you a clue as to where the information is held, either in a simvar (A: type variable) or an Lvar (L: type variable). If there is one, then both a-type and l-type variables cam be added to FSUIPC offsets amd them used.

John

 

Posted

John

Thanks again for the quick reply.

I figured all the offsets except for the Avionics Bus 1. 

I would like to add a free offset (for example 1012) to the A:CIRCUIT SWITCH ON:24 and another one to A:CIRCUIT SWITCH OFF:?

I looked in the Advanced user guide and this forum and could not find an answer.

Can you please explain how to assign a free offset to that Cessna 172 G1000 Carenado in P3D v5 to Avionics Bus 1.

Thanks again

Posted
14 hours ago, raynald1 said:

Can you please explain how to assign a free offset to that Cessna 172 G1000 Carenado in P3D v5 to Avionics Bus 1.

Ah...apologies - in my previous response I was thinking of  MSFS / FSUIPC7 (event though you clearly state you were using P3Dv5. Sorry about that. Please ignore what I said about presets and the MF HubHop site - these will also be for MSFS / FSUIPC7 only.

14 hours ago, raynald1 said:

I would like to add a free offset (for example 1012) to the A:CIRCUIT SWITCH ON:24 and another one to A:CIRCUIT SWITCH OFF:?

I looked in the Advanced user guide and this forum and could not find an answer.

For FSUIPC6, it is on page 36, section Additional Simulator Variables (simvars) to FSUIPC Offsets (v6.1.8 and later only). However, I doubt very much that those simvars exist in P3Dv5.
You could try listing the available lvars to see if there is one that holds avionics bus state. There is a control provided for this - List Local Panel Vars - assign that to a button or keypress and use it to list the available lvars in the FSUIPC6.log file (or, better, check the Send to console window checkbox to see them logged). If there is one available, then you can add this to a free FSUIPC offset, although you would need a lua script for that (I can help you with this if needed).

John

 

Posted
10 hours ago, raynald1 said:

Now, what do I do with it?

You can add it to a free/spare FSUIPC offset using a lua script and then use that in the offset condition. To add it to an FSUIC offset, use the following lua script (this adds to offset 0xA000 - you can change if already using that offset):

function addLvarToOffset(varname, value, userParameter)
    ipc.writeUB(0xA000, value)
end

event.Lvar("L:ASD_C172SP_SWITCH_AVIONICS_L", 200,"addLvarToOffset", 0)

Save that to a *.lua file (e.g. addLvarToOffset.lua)  in your FSUIPC installation folder and then have it auto-started in your C172 profile - see section Automatic running of Macros or Lua plugins on page 41 of the Advanced User guide for details on how to do this.

 

  • 2 months later...
Posted

We finally created a full switch panel for the Cessna 172 in P3D. We were able to program all the switches correctly.

One last step: Most of the time, the switches on the physical panel will not be synchronized with the simulated aircraft on startup. For example, the Master ALT switch on the physical panel is off while the Master ALT is ON in the simulated aircraft. That causes a "reverse" effect and the switches are not at the same value when we move the physical switch.

Would someone help me write a small script to check for the value of the simulated switch position before moving the physical switch.

For example:

1. The simulated Master ALT in ON and the physical switch is OFF. The 2 values are not equal therefore the simulated switch will not move when I move the physical switch.

2. Now the 2 switches have the same value (ON) therefore the simulated switch will move when the physical switch is moved.

Thanks

Posted
11 hours ago, raynald1 said:

Would someone help me write a small script to check for the value of the simulated switch position before moving the physical switch.

For example:

1. The simulated Master ALT in ON and the physical switch is OFF. The 2 values are not equal therefore the simulated switch will not move when I move the physical switch.

2. Now the 2 switches have the same value (ON) therefore the simulated switch will move when the physical switch is moved.

You can do this with an "offset condition" - see page 24 of the Advanced User guide, section ADDING OFFSET CONDITIONS. You need to have an offset that holds the current switch position, then you can add a test on this value to determine if the assignment should be triggered or not, depending upon what value the offset holds.
Try adding this yourself - if you need further assistance then please show me/attach your FSUIPC6.ini file.

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.