• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA To command the propeller lever with a switch

Messages
61
Country
france
I want to control the position of the propeller with a switch.
when you press this switch, the propeller lever must decrease up to -25%
I wrote this code, but it doesn't work.
What is wrong?

Code:
<PartInfo>
        <Name>00-NORD_Cde_Drapeau_G</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                  <Code>
	        (L:Cde_Drapeau_G,number) 50 *
                 </Code>               
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
           <TooltipText>Drapeau commande G</TooltipText>
            <CallbackCode>
              (L:Cde_Drapeau_G,number) ! (&gt;L:Cde_Drapeau_G,number)	
              (L:Cde_Drapeau_G,number) 1 == if{ -25 (&gt;A:GENERAL ENG PROPELLER LEVER POSITION:1,Percent) }
            </CallbackCode>
        </MouseRect>
</PartInfo>
 
Last edited:
You can't write to A:Vars in XML, you need to use an Event ID so your last line should look like:

(L:Cde_Drapeau_G,number) 1 == if{ 1 (&gt;K:KEY_PROP_PITCH1_DECR) }

That will reduce the prop pitch lever, I'm not sure how much by exactly as that's preset in FSX.

Alternatively you can use the AXIS_PROPELLER_SET event ID to set an exact value which you'd have to calculate each time.

The complete set of Event IDs are in the SDK, there are about six options for each prop so you should be able to find one that works for what you want.
 
Thank you for your help.
this code works correctly :
Code:
<PartInfo>
        <Name>00-NORD_Cde_Drapeau_G</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
	      (L:Cde_Drapeau_G,number) 50 *
	       </Code>
            <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Drapeau Gauche</TooltipText>
            <CallbackCode>
		(L:Cde_Drapeau_G,number) ! (&gt;L:Cde_Drapeau_G,number)
		(L:Cde_Drapeau_G,number) 1 == 
		if{ [B][COLOR="Red"]-4096 (&gt;K:PROP_PITCH1_SET)[/COLOR][/B] }
	</CallbackCode>
        </MouseRect>
</PartInfo>

But how to reset (L:Cde_Drapeau_G,number) to 0 when PROP_PITCH1 is greater than 0 ?
Code:
(A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) 0 &gt; if{ 0 (&gt;L:Cde_Drapeau_G,number) }
doesn't work correctly.
 
But how to reset (L:Cde_Drapeau_G,number) to 0 when PROP_PITCH1 is greater than 0 ?
Code:
(A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) 0 &gt; if{ 0 (&gt;L:Cde_Drapeau_G,number) }
doesn't work correctly.

Hm i don't see anything wrong in your code :confused:

Does (A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) ever go higher than 0? Or does L:Cde_Drapeau_G,number get set to a different value elsewhere in the gauge (or another gauge)?
In other words i would check the value of the variables using the blackbox gauge.

grt
Willem
 
Here the full code:

Code:
<PartInfo>
        <Name>00-NORD_Cde_Drapeau_G</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                  <Code>
			  (L:Cde_Drapeau_G,number) 50 *
		    </Code>
            	    <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Drapeau Gauche</TooltipText>
            <CallbackCode>
		(L:Cde_Drapeau_G,number) ! (&gt;L:Cde_Drapeau_G,number)
		(L:Cde_Drapeau_G,number) 1 == 
		if{ -4096 (&gt;K:PROP_PITCH1_SET) }
		[B][COLOR="Blue"](A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) -25 &gt;
                  if{ 0 (&gt;L:Cde_Drapeau_G,number) }[/COLOR]	[/B]
            </CallbackCode>
        </MouseRect>
	 <Visibility>
      		<Parameter>
        		<Code>
          		(L:Cde_Drapeau_G,number) if{ 1 } els{ 0 }
        		</Code>
      		</Parameter>
   	 </Visibility>
</PartInfo>

(L:Cde_Drapeau_G,number) exists only in this code.

What I want to do :
  1. When I press the button, the propeller is feathered;
  2. When the PROPELLER LEVER leaves the position -25, the button controlled by (L:Cde_Drapeau_G,number) go back to the initial position and (L:Cde_Drapeau_G,number) = 0.
This part of the code doesn't work.
 
Even by changing this value, the code doesn't work.

And this code also doesn't work. :banghead:


Code:
(A:PROP BETA:1,degrees) 15 &gt;
if{ 0 (&gt;L:Cde_Drapeau_G,number) }

For information the aircraft.cfg file has the following lines
Code:
beta_max=65.0					
beta_min=15.0
beta_feather=96.0
 
Here the full code:

Code:
<PartInfo>
        <Name>00-NORD_Cde_Drapeau_G</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                  <Code>
			  (L:Cde_Drapeau_G,number) 50 *
		    </Code>
            	    <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Drapeau Gauche</TooltipText>
            <CallbackCode>
		[COLOR="Red"](L:Cde_Drapeau_G,number) ! (&gt;L:Cde_Drapeau_G,number)[/COLOR]
		(L:Cde_Drapeau_G,number) 1 == 
		if{ -4096 (&gt;K:PROP_PITCH1_SET) }
		[B][COLOR="Blue"](A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) -25 &gt;
                  if{ 0 (&gt;L:Cde_Drapeau_G,number) }[/COLOR]	[/B]
            </CallbackCode>
        </MouseRect>
	 <Visibility>
      		<Parameter>
        		<Code>
          		(L:Cde_Drapeau_G,number) if{ 1 } els{ 0 }
        		</Code>
      		</Parameter>
   	 </Visibility>
</PartInfo>

Looks like L:Cde_Drapeau_G,number gets swapped from 0 to 1 again in the next gauge cycle (marked red).
It just loops really.
First the value gets toggled, then if it is 1 the prop pitch gets set, then if the lever posn is more than -25 the value is set to 0.
Next gauge cycle the value gets toggled again, then if it is 1 the prop pitch gets set etc.

Could that be the problem?
Did you check the values in question in the sim by using the blackbox gauge?

(also, can A:GENERAL ENG PROPELLER LEVER POSITION:1,percent have a negative value??)
Hope this helps!

grt
Willem
 
Last edited:
I found the solution !
First I have this code to animate the propeller :

Code:
<PartInfo>
        <Name>00-NORD_Cde_Drapeau_G</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                  <Code>
			  (L:Cde_Drapeau_G,number) 50 *
		    </Code>
            	    <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Drapeau Gauche</TooltipText>
            <CallbackCode>
		(L:Cde_Drapeau_G,number) ! (&gt;L:Cde_Drapeau_G,number)
		(L:Cde_Drapeau_G,number) 1 == 
		if{ -4096 (&gt;K:PROP_PITCH1_SET) }
            </CallbackCode>
        </MouseRect>
	 <Visibility>
      		<Parameter>
        		<Code>
          		(L:Cde_Drapeau_G,number) if{ 1 } els{ 0 }
        		</Code>
      		</Parameter>
   	 </Visibility>
</PartInfo>
Second, I've created a little square in the VC tagged with this code :
Code:
<PartInfo>
    <Name>00-NORD_Cde_Drapeau_Reset</Name>
    <Visibility>
      <Parameter>
        <Code>
          <!-- Si la manette hélice est supérieure à la position drapeau, le bouton drapeau revient à la position initiale.-->
          	(A:GENERAL ENG PROPELLER LEVER POSITION:1,percent) -1 &gt;
		(L:Cde_Drapeau_G,number) 1 == and
		if{ 0 (&gt;L:Cde_Drapeau_G,number) }

		(A:GENERAL ENG PROPELLER LEVER POSITION:2,percent) -1 &gt;
		(L:Cde_Drapeau_D,number) 1 == and
		if{ 0 (&gt;L:Cde_Drapeau_D,number) }
        </Code>
      </Parameter>
    </Visibility>
 </PartInfo>
Hope that will be useful to someone.
And thank you for your help
 
Back
Top