• 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 Gyro drift error

Messages
189
Country
hungary
Hello

I wrote the CallbackCode below for a KA51 switch . Pilot can adjust the gyro drift error with the bottom switch :

left : CCW (0)
spring back to center : no adjust (1)
right - CW (2)

The anim of the switch is works great, but the drift error changes only once for a click. Yes I know that it is normal :) but I'd like to know how to get continous change until I hold down the mouse button.

Maybe I need a L: variable, which stepped in <CallbackCode> and put this value to GYRO_DRIFT_SET in the <Code> section ? :idea:

Code:
  <CallbackCode>
          
                (M:Event) 'LeftSingle' scmi 0 ==
                 if{ 0 (>L:ka51drift, enum) (>K:GYRO_DRIFT_INC) }
                      
                (M:Event) 'LeftRelease' scmi 0 ==
                  if{ 1 (>L:ka51drift, enum) }
              
                (M:Event) 'RightSingle' scmi 0 ==
                 if{ 2 (>L:ka51drift, enum) (>K:GYRO_DRIFT_DEC) }  
                              
                (M:Event) 'RightRelease' scmi 0 ==
                 if{ 1 (>L:ka51drift, enum) }
      
     </CallbackCode>
 
Nope! Just add
+DownRepeat
to your <MouseFlags> list!
The command will repeat continuously until you release the mouse button...
 
Nope! Just add
+DownRepeat
to your <MouseFlags> list!
The command will repeat continuously until you release the mouse button...


Thanks :wave:

How more little secret is NOT in SDK ? o_O Or which SDK document should I read?
 
In connection with this thread I'd like to know how it is possible to avoid backward rotation of a needle when I add a <Lag> parameter to it ? The "problem" comes with ADF needle, comapss card and so on. I want to replace the "jump-to-position" behavior to a "rotate-to-position" behavior when a needle or compass card receive a radio signal.
When I add <Lag> the anim turn around at the 0. keyframe.
 
When I add <Lag> the anim turn around at the 0. keyframe.

You can solve this issue by adding a custom delay to your needle, in a script written either on the model itself or in a configuration gauge.

Tom
 
You can solve this issue by adding a custom delay to your needle, in a script written either on the model itself or in a configuration gauge.

Tom

Do you have an example? :rolleyes:

My idea - which I did not put into code yet - to compare one of the A: heading variable (degrees os radians) with an L: variable (degrees os radians) in the <Code> section. If (A:variable) greater then (L:something) then (L:something) ++ (>L:something). If less then (L:something) -- (>L:something).

It possible to compare for example A:plane heading magnetic with L:plane heading magnetic ?
 
Do you have an example?

Well, not exactly a specific example, but I use a generic damping macro to manage custom lags.

I built it from Ron Freimuth's original formula :
It contains other two macros embedded which control Pause state and Sim Rate.


Code:
    <Macro Name="Time">(P:Absolute time,seconds)</Macro>
    <Macro Name="Paused">@Time (L:MyTimer,seconds) - 0 ==</Macro>
    <Macro Name="SimRate">(P:Simulation rate, number)</Macro>  

    <Macro Name="Damped">
        (L:@3,number) @Paused !
        if{ p @1 sp0 (L:@3,number) s1 @2 * 1.0 @2 - @SimRate * l0 * +
            l0 d l1 > if{ min } els{ max }
            d (>L:@3,number)
            }
    </Macro>

And the triggering code:

@Damped(n1,n2,n3)

where n1 is the desired/target value, n2 is a coefficient and n3 is the current value.

Following your example (pseudocode):

(L: heading variable (degrees os radians)) = current value
(A:heading variable (degrees os radians)) = the desired/target value
0.985 = example of a damping coefficient. Controls the amplitude of the lag. The closer to 1, the greater the lag and vice versa.

then :

Code:
  (A:heading variable, (degrees or radians)) sp9
  (L:heading variable, (degrees or radians))  (>L:heading variable,number)
  @Damped(l9,0.985,heading variable)  (>L:heading variable, (degrees or radians))
  ...
  ....
  .....
  @Time (>L:MyTimer,seconds)

Where (L: heading variable, (degrees or radians)) is the var to display.
The last command is used to keep record of Pause state.

This macro/method is to be used inside a panel gauge, but the code, if verbosed, can be put in modeldef as well.

Tom
 
Last edited:
If one uses a "logic.xml" gauge, then this could be placed there and simply pass the control variable to the modeldef.xml script for the needle...
 
Well, not exactly a specific example, but I use a generic damping macro to manage custom lags.

I built it from Ron Freimuth's original formula :
It contains other two macros embedded which control Pause state and Sim Rate.


Code:
    <Macro Name="Time">(P:Absolute time,seconds)</Macro>
    <Macro Name="Paused">@Time (L:MyTimer,seconds) - 0 ==</Macro>
    <Macro Name="SimRate">(P:Simulation rate, number)</Macro> 

    <Macro Name="Damped">
        (L:@3,number) @Paused !
        if{ p @1 sp0 (L:@3,number) s1 @2 * 1.0 @2 - @SimRate * l0 * +
            l0 d l1 > if{ min } els{ max }
            d (>L:@3,number)
            }
    </Macro>

And the triggering code:

@Damped(n1,n2,n3)

where n1 is the desired/target value, n2 is a coefficient and n3 is the current value.

Following your example (pseudocode):

(L: heading variable (degrees os radians)) = current value
(A:heading variable (degrees os radians)) = the desired/target value
0.985 = example of a damping coefficient. Controls the amplitude of the lag. The closer to 1, the greater the lag and vice versa.

then :

Code:
  (A:heading variable, (degrees or radians)) sp9
  (L:heading variable, (degrees or radians))  (>L:heading variable,number)
  @Damped(l9,0.985,heading variable)  (>L:heading variable, (degrees or radians))
  ...
  ....
  .....
  @Time (>L:MyTimer,seconds)

Where (L: heading variable, (degrees or radians)) is the var to display.
The last command is used to keep record of Pause state.

This macro/method is to be used inside a panel gauge, but the code, if verbosed, can be put in modeldef as well.

Tom


Thank you ! I would never figure it out by myself :)
 
Back
Top