• 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 COM tune without battery

Messages
189
Country
hungary
Hello

I was thinking about this issue many, tried a lots of things but I can not figure it out, but I believe it's must be easy :)

So, in my plane there are "old-school" COM and ADF radio. Both of them have mechanical tuner. This mean that the pilot can rotate the dial directly. Therefore it is not necessary to switch on the battery for tuning the frequency, and he can see the frequency on the radio. He need the battery ON/main switch ON/radios ON for transmit/receive the radio signals only. My problem is that in FS when I switch OFF everything the anim of the knob will blocked, and the frequency does not change.

I think one solution could be that I control the tuner knob with an L: variable, which also set the COM or ADF frequency, but maybe somebody knows a better solution.
 
The L: variable solution is the one I use, but making sure that there is no disconnect with the actual FS frequency can be a pain.
 
Thanks ! Now I figured out the code for the knob and it's turning the frequency dial also. The variable L:lun_1_hang plays a click sound for the knob. It works good, except one thing. I was wrong in the first post, because the knob has end position at the 118 and 136 value also, so I can not rotate it continuously. The code below works this way, so I'm glad, but the sound does not a stops when the knob gets there. How can I stop the sound at 118 and 136MHz?

Second question : I want to 'give' the value L:com1 to the COM frequency. I have to use COM_RADIO_SET ? I tried this without succes (L:com1,number) 118 + (>K:COM_RADIO_SET,xxx), should it work? Can I give unit to the EventID ? I mean : (K:COM_RADIO_SET,Mhz) Sorry for the stupid question, but from SDK I don't really understand what can I do with this EventID...:rolleyes:


Code:
<PartInfo>
 <Name>gomb_com_MHz</Name>
  <AnimLength>180</AnimLength>
    <Animation>
      <Parameter>
       <Code>(L:com1,number) 10 * </Code>
      </Parameter>
   </Animation>
    <MouseRect>
     <Cursor>hand</Cursor>
     <TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle</MouseFlags>
     <CallbackCode>
                (M:Event) 'WheelUp' scmi 0 == 
                if{ (L:com1,number) ++ 18 min (>L:com1,number) 1 (>L:lun_1_hang,enum) } 
                  
                (M:Event) 'WheelDown' scmi 0 ==  
                if{ (L:com1,number) -- 0 max (>L:com1,number) 1 (>L:lun_1_hang,enum)  } 
     </CallbackCode>
   </MouseRect>
 </PartInfo>
 
In a modeldef.xml script, one way is to simply include the entire routine into the <CallbackCode> mouse click section:

Code:
        118 (L:B737_Com1_WHOLE_TUNE,enum) + (L:Com1Decimal,enum) +
        100 * 10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:COM_RADIO_SET)
 
You could set up a rng (range) within which the sound would play, otherwise remain silent...

(L:com1,number) 0 18 rng if{ playsound }
 
That was my first idea also, but the L:com1 variable is always between 0 and 18. But now I have a bigger problem, I noticed today and it almost drive me crazy, I can not locate the mistake :confused: Suppose that the COM tuned to 127.450MHz. From here when I tune to 128.450Mhz, the freqency changes to 128.440 ! Similar to this i can tune 128.690 and 128.940 MHz ?! The fault appears only when the freq changes from 127 to 128, or vice versa ...

Code:
<PartInfo>
 <Name>gomb_com_MHz</Name>
  <AnimLength>180</AnimLength>
    <Animation>
      <Parameter>
       <Code>(A:COM ACTIVE FREQUENCY:1, MHz) 118 - flr 10 * </Code>
      </Parameter>
   </Animation>
    <MouseRect>
     <Cursor>hand</Cursor>
     <TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle</MouseFlags>
     <CallbackCode>
      (M:Event) 'WheelUp' scmi 0 == 
      if{ (L:com1,enum) ++ 18 min (>L:com1,enum)
        1 (>L:lun_1_hang,enum) 
      118 (L:com1,enum) + (L:Com1decimal,enum) +
         100 * 10000 % int
         d 10 % r 10 / int
         d 10 % r 10 / int
         d 10 % r 10 / int
         16 * +
         16 * +
         16 * + (>K:COM_RADIO_SET) } 
                       
      (M:Event) 'WheelDown' scmi 0 ==  
      if{ (L:com1,enum) -- 0 max (>L:com1,enum) 
        1 (>L:lun_1_hang,enum) 
      118 (L:com1,enum) + (L:Com1decimal,enum) +
         100 * 10000 % int
         d 10 % r 10 / int
         d 10 % r 10 / int
         d 10 % r 10 / int
         16 * +
         16 * +
         16 * + (>K:COM_RADIO_SET) } 
     </CallbackCode>
   </MouseRect>
 </PartInfo>


Code:
<PartInfo>
    <Name>gomb_com_kHz</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:COM ACTIVE FREQUENCY:1, KHz) 100 / 10 % 36 * </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>hand</Cursor>
      <TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle</MouseFlags>
     <CallbackCode>
      
      (M:Event) 'WheelUp' scmi 0 == 
      if{ (L:com1decimal,enum) 0.025 + 0.975 min (>L:com1decimal,enum) 
        1 (>L:lun_1_hang,enum) 
      118 (L:com1,enum) + (L:Com1Decimal,enum) +
         100 * 10000 % int
         d 10 % r 10 / int
         d 10 % r 10 / int
         d 10 % r 10 / int
         16 * +
         16 * +
         16 * + (>K:COM_RADIO_SET) } 
                  
      (M:Event) 'WheelDown' scmi 0 ==  
      if{ (L:com1decimal,enum) 0.025 - 0 max (>L:com1decimal,enum) 
        1 (>L:lun_1_hang,enum) 
      118 (L:com1,enum) + (L:Com1decimal,enum) +
         100 * 10000 % int
         d 10 % r 10 / int
         d 10 % r 10 / int
         d 10 % r 10 / int
         16 * +
         16 * +
         16 * + (>K:COM_RADIO_SET) } 
     </CallbackCode>
    </MouseRect>
 </PartInfo>
 
Sorry to say this, but I've not yet found a solution myself...:eek: :(
 
Bill,

I seem to remember this topic from about a year ago. Looking at some code I wrote, I noticed I multiplied the MHz by a number with .001 on the end, because at least part of the error came from rounding down and the .001 was enough to get it to round up. The associated modeldef code was

Code:
<PartInfo>
		<Name>drum_ILS_SPD</Name>
		<AnimLength>360</AnimLength>
		<Animation>
			<Parameter>
				<Code>(A:NAV ACTIVE FREQUENCY:1, MHz) 100.001 * 10 % int 36 *</Code>
			</Parameter>
		</Animation>
	</PartInfo>

Not sure how you would fit that fudge in your code, but it appears to work.

"SPD" was second place of decimals

Roy
 
Some more detail : from 118.000 to 127.200 MHz there's no fault. But at this point, when the MHz value changes to 128, the value of kHz will be .190 and remains on this value until 136 MHz - if you don't tune it. In the range 127.200-136.975 there is four "faulty" kHz value : 190,440,690,940.
 
Thank you Holmes ! I made a try based on your comment, and with the code below tha faults disappeared :)

Code:
118 (L:com_mhz,number) + (L:com_khz,number) +
         [COLOR="Red"]100.001[/COLOR] * 10000 % int 
                 d 10 % r 10 / int 
                 d 10 % r 10 / int 
                 d 10 % r 10 / int 
                 16 * + 
                 16 * + 
                 16 * + 
               (>K:COM_RADIO_SET)
 
Thank you Roy. I was struggling to get the first place of decimals to behave in my 2D gauge which would not change when the decimal part was .000. I followed your lead and used:-
Code:
    <Shift>
      <Value>(A:Com active frequency:1,Megahertz) 10.001 * 10 % int</Value>
    </Shift>

Regards, Ted.
 
Not sure how you would fit that fudge in your code, but it appears to work.

Thanks for the reminder, Roy. I'm quite sure I used to know that, but my memory isn't all that reliable any longer...

I'm off to update the Wiki entry so it won't get lost again! :D
 
Just one more question : this decimal-to-BCD macro is applicable for the ADF freq ? FS Wiki talks about COM and NAV only :rolleyes:
 
Reloaded :) I tried NOT to post here if it is not necessary, and I spent some days with the coding of the knobs of my COM radio. Now the MHz knob is OK, but not the kHz knob and I'd like to make it as real as possible.

So, I had a chance to see and try the real radio in the real airplane and I experienced that the kHz knob don't have end positions, it can rotate continuously. I made the code below, which steppings the value by 0.025kHz upwards and downwards also, so it is good. First fault is that at every 1 kHz it steppings the MHz also, I mean for example 118.975 followed by 119.000, not 118.000. In other words the two knobs of the COM radio should work independently from each other.

The second one is that the tuning of kHz stops at 118.000 and 136.975.

How can I avoid this errors?

Code:
(M:Event) 'WheelUp' scmi 0 ==   if{ (L:com_khz,number) 0.025 + 1 % (>L:com_khz,number) 
(M:Event) 'WheelDown' scmi 0 ==  if{ (L:com_khz,number) 0.025 - 1 % (>L:com_khz,number)
 
What do your display gauges (i.e. the knobs) use as their variables? If it is using L: variables it should not have that limitation. And it you have two separate controls, its often best to use two separate L: variables.
 
Shit, I should think about this :D Thank you. I use A:COM ACTIVE FREQUENCY for knob anim and freq display also. I will try with L: variables at home. But as I remember if I tune from ATC window it does not rotate the knob to the correct position. Anyway that's not a big problem :rolleyes:
 
Back
Top