Separate Gauges

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
fformulaa
Posts: 10
Joined: Fri Dec 04, 2015 8:02 pm

Separate Gauges

Post by fformulaa »

Hello,

We are currently using P3D for our full-cockpit SD3-60 trainer and I have a small question regarding separate gauge clusters. the SD3-60 has a PIC and SIC gauge cluster, (separate airspeed, VSI, altimeter, etc) We would like to add a generator1/2 failure, which is no problem for me to simulate, but I am having trouble trying to fail the instruments separately.

In P3D failures there is "Fail Airspeed Indicator 1" and "Fail Airspeed Indicator 2". My problem is simconnect only has "AIRSPEED INDICATED". I've tried "AIRSPEED INDICATED1" or "AIRSPEED INDICATED 1" and that doesn't work.

Also, I have encoders that trigger the "KOHLSMAN_INC" and "KOHLSMAN_DEC" for the altimeter adjustment and it's adjusting both of my altimeters(ie, left encoder changes both). Is there a "KOHLSMAN_INC_1/2" or something to indicate to change only the left or right gauge? I'm assuming it would have to correspond to a "Indicated Altitude 1/2" or something but there is only a global "Indicated Altitude"


In the aircraft config file the gauges are separated:
[altimeters]
altimeter.0=1
altimeter.1=1
[airspeed_indicators]
airspeed_indicator.0=1
airspeed_indicator.1=1


Any help with my madness would be greatly appreciated!

Oh, the gauges I'm using are separate of the model. So it's the variables and event ID's I'm more interested in. Thanks!
User avatar
WarpD
Posts: 1469
Joined: Mon Feb 14, 2011 5:29 am

Re: Separate Gauges

Post by WarpD »

It would be AIRSPEED INDICATED:1 or AIRSPEED INDICATED:2

# (>K:KOHLSMAN_INC, number) where # is the altimeter number you want to adjust.
Ed Wilson
Senior Developer
Mindstar Aviation
fformulaa
Posts: 10
Joined: Fri Dec 04, 2015 8:02 pm

Re: Separate Gauges

Post by fformulaa »

It works! You are the cat's meow.

As far as setting the Kohlsman, I am using simconnect in my .Net app. I'll have to read up on the TransmitClientEvent and see how I can set the event to gauge 1 or 2. I have them separate now as you described and when I fire the event, only gauge 1 sets the Kohlsman. This means there must be a way to set gauge 2 through simmconnect somehow. Probably has something to do with the eventdata structure.

Code: Select all

p3d_simconnect.TransmitClientEvent(0, EVENTS1.KOHLSMAN_INC, .theStatus, NOTIFICATION_GROUPS.GROUP0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY)
You have given me much hope. Thank you so much for the help!
fformulaa
Posts: 10
Joined: Fri Dec 04, 2015 8:02 pm

Re: Separate Gauges

Post by fformulaa »

So I can't figure out how to INC/DEC the Kohlsman on altimeter 2 using SimmConnect.

Is there a way to run this through simconnect?

Code: Select all

# (>K:KOHLSMAN_INC, number) where # is the altimeter number you want to adjust.
Maybe there's another option? My setup is:
Encoder hooked up to Arduino. Encoder event is sent to my .net app from the Arduino. The app sends info to P3D.

Would I have to use the "AddDataDefinition" before calling the "TransmitClientEvent"?

Any help would be greatly appreciated!
fformulaa
Posts: 10
Joined: Fri Dec 04, 2015 8:02 pm

Re: Separate Gauges

Post by fformulaa »

Figured it out. Here's a solution that worked for me:

Code: Select all

	'Create the variables
    Enum DEFINITIONS
        Kohls
    End Enum   

   <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)>
    Structure Kohls2
        Public inHg As UInteger
    End Structure

    Private kohls As Kohls2
	
	
	'add the definition to our second altimeter gauge, once connected to P3D through SimConnect
	p3d_simconnect.AddToDataDefinition(DEFINITIONS.Kohls, "Kohlsman setting hg:2", "inHG", SIMCONNECT_DATATYPE.INT32, 0.0F, SimConnect.SIMCONNECT_UNUSED)
	
	
	
	'Call the setting on any event you set.(Button click, mouse, key, etc.)
	Dim Players_Plane = 0
	kohls.inHg = 31.0 '<-- set the kohls value. You can read the value before hand and INC/DEC from the current value.
	p3d_simconnect.SetDataOnSimObject(DEFINITIONS.Kohls, Players_Plane, 0, kohls.inHg)

Would be SUPER cool if there was a "KOHLSMAN_2_INC/DEC" event but at least there's a way!
Post Reply