• 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.

FSX [SOLVED] Coaxial Knobs for Transponder Code : XML gauge

Messages
6
Country
japan
Good mooning / afternoon / evening ,

I'm trying to make a TXPNDR gauge like Collins CTL92.

Two coaxial knobs set the active code.
The larger knob changes the two larger digits, and the smaller knob changes the two smaller digits.
The left two digits and the right two digits are independent of each other.

ctl92.jpg


How can I write XML for this operation?

many thanks
 
Last edited:
Hi,

Use two L: variables for each half. When the knobs are turned, vary those variables using code to display only the correct values. Then combine the two values, convert to BCD and use the K:XPNDR_SET event to set the actual transponder. This could be done in a mouse click section so the transponder is reset after each click.
 
Thanks for your reply.

I have tried higher and lower 2-digits-set variables are controlled separately , however , those variables are still in decimals (0-9 each).
How can I combine higher and lower sets , and , convert to octal numbers (0-7).

many thanks
 
You could try (untested)

Code:
(L:HigherNumber,number) 100 * (L:LowerNumber,number) + (>L:XPNDRNums,number)
(L:XPNDRNums,bco16) (>K:XPNDR_SET)

Walter
 
Thanks for your reply.

I have tried higher and lower 2-digits-set variables are controlled separately , however , those variables are still in decimals (0-9 each).
How can I combine higher and lower sets , and , convert to octal numbers (0-7).

many thanks
use loop for increment and decrement. by unit, tens, hundreds, thousands...so on.
decimal can be tricked by multiply (you need a copy for display purpose).
just give an idea. I have done this so many times in C++ code.
 
This works.
By knowing when to "carry over" you can use the stock commands. No need for exotic math nor the need to monitor/convert the current XPNDR code.
The if's{} in the following code is the carry over, following that is the always present inc/dec of the lowest digit of the 1/2 XPNDR code.

XML:
<Macro Name="ExtDigit">
    @1 sp0
    @3 0 >
    if{ l0 10 @3 pow * sp0 }
    l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int
</Macro>

<!-- TEST DISPLAY -->
<String>XPNDR = %((A:TRANSPONDER1 CODE, number))%!04d!%</String>

<!-- INCREASE THE LOWER HALF OF THE XPNDR CODE -->
<Click Repeat="Yes">@ExtDigit((A:TRANSPONDER1 CODE, number),1,0) 7 == if{ (>K:XPNDR_10_INC) } (>K:XPNDR_1_INC)</Click>

<!-- DECREASE THE LOWER HALF OF THE XPNDR CODE -->
<Click Repeat="Yes">@ExtDigit((A:TRANSPONDER1 CODE, number),1,0) 0 == if{ (>K:XPNDR_10_DEC) } (>K:XPNDR_1_DEC)</Click>

<!-- INCREASE THE UPPER HALF OF THE XPNDR CODE -->
<Click Repeat="Yes">@ExtDigit((A:TRANSPONDER1 CODE, number),3,0) 7 == if{ (>K:XPNDR_1000_INC) } (>K:XPNDR_100_INC)</Click>

<!-- DECREASE THE UPPER HALF OF THE XPNDR CODE -->
<Click Repeat="Yes">@ExtDigit((A:TRANSPONDER1 CODE, number),3,0) 0 == if{ (>K:XPNDR_1000_DEC) } (>K:XPNDR_100_DEC)</Click>
 
Last edited:
Back
Top