Jump to content
Sign in to follow this  
jpravain

Making an attitude adjust switch for the Lear 25

Recommended Posts

I 'm getting back into simming and I 'm learning the basics of xml programming. I would like to add a simple attitude adjust gauge when the autopilot is engaged to adjust the pitch just like in the real aircraft. I have the bitmaps needed to make the gauge. But I 'm thinking about leaving it transparent and having it as a mouse click. Can some one please assist me? Thanks, Jason

 

Here is a pic of the autopilot...

Share this post


Link to post
Share on other sites

Here is my FS2004 code for the visible wheel; I have 4 images that are each slightly shifted up (or down?) from each other:

 

  <!-- ======================= Pitch Wheel ========================== -->


<Element>
  <Position X="15" Y="9"/>
  <Select>
	 <Value> (G:Var3) </Value>
	 <Case Value="0">
		<Image Name="vs_wheel_1.bmp"/>
	 </Case>
  </Select>
  </Element>

  <Element>
  <Position X="15" Y="9"/>
  <Select>
	 <Value> (G:Var3) </Value>
	 <Case Value="1">
		<Image Name="vs_wheel_2.bmp"/>
	 </Case>
  </Select>
  </Element>

  <Element>
  <Position X="15" Y="9"/>
  <Select>
	 <Value> (G:Var3) </Value>
	 <Case Value="2">
		<Image Name="vs_wheel_3.bmp"/>
	 </Case>
  </Select>
  </Element>

  <Element>
  <Position X="15" Y="9"/>
  <Select>
	 <Value> (G:Var3) </Value>
	 <Case Value="3">
		<Image Name="vs_wheel_4.bmp"/>
	 </Case>
  </Select>
  </Element>

 

Then there is the mouse code:

 

<!-- pitch control -->

<Area Left="15" Top="9" Width="14" Height="52">
  <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_PITCH_REF"/>
	   <Area Bottom="26">
	<Cursor Type="DownArrow"/>
	 <Click Repeat="Yes" MouseWheelFlip="Yes">
	  0 (>K:AP_PITCH_REF_INC_DN)
	  (G:Var3) 1 + (>G:Var3)
	  (G:Var3) 4 == if{ 0 (>G:Var3) }
	</Click>
   </Area>

	   <Area Top="27">
	<Cursor Type="UpArrow"/>
	<Click Repeat="Yes" MouseWheelFlip="Yes">
	  0 (>K:AP_PITCH_REF_INC_UP)
	  (G:Var3) 1 - (>G:Var3)
	  (G:Var3) -1 == if{ 3 (>G:Var3) }
	</Click>
	   </Area>
</Area>

 

Note that this is attitude control, not V/S control. If you want that use different K: variables.

 

To activate that, I use this code for the Autopilot mode switch:

 

<!-- MODE SELECT -->

  <Area Left="106" Top="19" Width="45" Height="45">
	 <Tooltip>Mode: %((L:AP_SW, enum))%{case}%{:0}HDG/Pitch%{:1}Range%{:2}LOC%{:3}LOC/GS%{End}</Tooltip>
  <Area Right="22">
	 <Cursor Type="DownArrow"/>		
	 <Click>(L:AP_SW, enum) 1 - (>L:AP_SW, enum) (L:AP_SW, enum) 0 < if{ 0 (>L:AP_SW, enum) }  
		(L:AP_SW, enum) 0 == (A:Autopilot Master, bool) 1 == && if{ 0 (>K:AP_NAV1_HOLD_OFF) (A:Plane Heading Degrees Magnetic, degrees) (>K:HEADING_BUG_SET) (>K:AP_HDG_HOLD_ON) }
			(L:AP_SW, enum) 1 == (A:Autopilot Master, bool) 1 == && if{ 1 (>K:AP_NAV1_HOLD_ON) (A:autopilot altitude lock, bool) 0 == if{ 1 (>K:AP_ATT_HOLD_ON) 0 (>K:AP_WING_LEVELER_OFF) } }
	(L:AP_SW, enum) 2 == (A:Autopilot Master, bool) 1 == && if{ 1 (>K:AP_LOC_HOLD_ON) }
	 </Click>
  </Area>
  <Area Left="23">
	 <Cursor Type="UpArrow"/>
	 <Click>(L:AP_SW, enum) 1 + (>L:AP_SW, enum) (L:AP_SW, enum) 3 > if{ 3 (>L:AP_SW, enum) }
			(L:AP_SW, enum) 1 == (A:Autopilot Master, bool) 1 == && if{ 1 (>K:AP_NAV1_HOLD_ON) }
	(L:AP_SW, enum) 2 == (A:Autopilot Master, bool) 1 == && if{ 1 (>K:AP_LOC_HOLD_ON) }
	(L:AP_SW, enum) 3 == (A:Autopilot Master, bool) 1 == && if{ 1 (>K:AP_APR_HOLD_ON) }
	</Click>
  </Area>
</Area>

 

Note that the values of L:AP_SW (the AP mode switch) are:

 

0: HDG (Heading Hold)

1: NAV (VOR Hold)

2: LOC (Localizer Hold)

3: APR (ILS Approach Hold - Localizer and Glideslope)

 

Apparently the numbers that I place "into" the K: variables are not needed, but I haven't removed them yet.

 

Hope this helps,

Share this post


Link to post
Share on other sites

Thank you for your assistance. My attitude adjust gauge is a seperate gauge by itself. Very simple and not part of "1" unit for the autopilot. I am still learning the basics of xml. Here is what I have so far but the gauge is not showing up in the sim.

 

<Gauge Name="PITCH WHEEL" Version="1.0">

 

<Element>

 

<Select>

<Value> (G:Var3) </Value>

<Case Value="0">

<Image Name="Pitch1.bmp"/>

</Case>

</Select>

</Element>

 

<Element>

 

<Select>

<Value> (G:Var3) </Value>

<Case Value="1">

<Image Name="Pitch2.bmp"/>

</Case>

</Select>

</Element>

 

<Element>

 

<Select>

<Value> (G:Var3) </Value>

<Case Value="2">

<Image Name="Pitch3.bmp"/>

</Case>

</Select>

</Element>

 

<Element>

 

<Select>

<Value> (G:Var3) </Value>

<Case Value="3">

<Image Name="Pitch4.bmp"/>

</Case>

</Select>

</Element>

 

 

<Mouse>

<Area Width="15" Height="73">

<Tooltip ID="TOOLTIPTEXT_AUTOPILOT_PITCH_REF"/>

<Area Bottom="26">

<Cursor Type="DownArrow"/>

<Click Repeat="Yes" MouseWheelFlip="Yes">

0 (>K:AP_PITCH_REF_INC_DN)

(G:Var3) 1 + (>G:Var3)

(G:Var3) 4 == if{ 0 (>G:Var3) }

</Click>

</Area>

 

<Area Top="27">

<Cursor Type="UpArrow"/>

<Click Repeat="Yes" MouseWheelFlip="Yes">

0 (>K:AP_PITCH_REF_INC_UP)

(G:Var3) 1 - (>G:Var3)

(G:Var3) -1 == if{ 3 (>G:Var3) }

</Click>

</Area>

</Area>

<Mouse>

</Gauge>

 

 

I know something is a miss. Any help appreciated.

Share this post


Link to post
Share on other sites
</Area>
</Area>
<Mouse>
</Gauge>

 

Should be ---

 

 

</Area>
</Area>
</Mouse>			 <!-- NOTICE THE CLOSING </Mouse> TAG -->
</Gauge>

 

 

A little tip for you.. Since XML was originally designed for web use, you can use your internet browser to open up the gauge xml to check for simple syntax errors like the one above. The resulting code would have stopped parsing with an error and depending on your browser, will point to the error. The browser will not show other errors, like poor programming, misspelling of variables etcc.. just the tag formatting..

 

The rest of the code "seems" to be OK. ( Just woke up, no coffee )

 

Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...