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

MSFS Radio COM frequencies. A heads up about potential issues.

Messages
1,047
Country
australia
This is a warning for anyone coding a COM radio.

Back in the good old FSX days COM frequencies would end in 00, 25, 50 or 75. Using the fraction inc or dec events would change the COM frequency by 0.025 increments.

Well, it's 2021 now and many European airports are now using COM frequencies between those gaps (instead of 25hz gaps they can now use 8.33Hz gaps). For example, Blagnac (LFBO) uses 123.130 as ATIS frequency. If you load the C152, it is impossible to tune into 123.130 using the knobs on the radio as they use 25Hz increments. You have to open the ATC panel and select the ATIS service to tune the radio. It then becomes impossible to tune into ground on 121.900 as the 25Hz increments are all messed up so it's back to the ATC panel to tune the radio.

This raises an interesting issue for developers. Do you faithfully model an older radio that tunes in 0.025 increments or do you tune it in 0.005 increments so you can access those newer in-between frequencies such as 123.130?

The radio I am working on at the moment has keypad entry. A faithful reproduction limits it to 0.025 increments but I think I will have to allow 0.005 increments to make it useable in MSFS Europe. This is not a huge problem for me as the keypad allows for accurate entry but if your radio has knobs only then you are limited by the 25Hz increment by the INC and DEC events.
 
Messages
1,047
Country
australia
Also, new event commands that are undocumented. NAV_RADIO_SET_HZ and COM_RADIO_SET_HZ allow you to set radio frequencies in Hz so to set the COM to 126.700Mhz you would send 126700000 to COM_RADIO_SET_HZ (to convert Mhz to Hz you multiply by one million).

This works for any of the COM or NAV radio set events. Stick _HZ on the end and you can set them with Hz instead of FrequencyBCD16. COM2_STBY_RADIO_SET_HZ for example.

See asobo-vcockpits-instruments-generic\html_ui\Pages\VCockpit\Instruments\Generic\Radios\KX155A\KX155A.js
 

DragonflightDesign

Resource contributor
Messages
1,082
Country
northernireland
I don't have MS2020 but I'm pretty sure that a solution is to use the _SET event i.e. use the knobs to change numbers and each time a number changes, fire off a _SET event. I've never liked _INC and _DEC on any of the other sims - they can generate too much trouble.
 
Messages
1,047
Country
australia
The problem is the user can generate INC and DEC commands. If they have some sort of radio panel and map the radio controls to the INC and DEC commands then they are going to be able change the frequency by 0.025Mhz. Not a problem when all frequencies where in 0.025Mhz increments but in MSFS that is no longer the case for European airports.

I am going to use SET_HZ in my radio and set the increment and decrement amount to 0.005Mhz. That way, if the radio gets out of sync with user generated commands then the can get it back in sync by using my radio. Now, this also can cause other issues. In FSX if the user swapped airplanes the radio frequencies would remain the same so if the user has set the radio to 123.130 then switch to a plane that doesn't support 0.005 increments then the only way they can get the radio back in sync is using the ATC panel to change the frequency. Of course, I don't think you can actually change planes in MSFS without quitting the flight (or you use the developer aircraft switch).
 
Messages
255
Country
germany
Hey guys, inside MSFS seetings there is a behaviour file that allows to determine the increase and decrease value. So I guess it's not an issue at all to change this file. I'm not currently on my flight system but will place the name of the file for those who are interrested to change 0.025 to 0.005. Disatvantage, it will take 5 times longer to get to the final value from where you start today.
 
Messages
1,047
Country
australia
Hey guys, inside MSFS seetings there is a behaviour file that allows to determine the increase and decrease value. So I guess it's not an issue at all to change this file. I'm not currently on my flight system but will place the name of the file for those who are interrested to change 0.025 to 0.005. Disatvantage, it will take 5 times longer to get to the final value from where you start today.
I'd be interested to see that file. The commands we are talking about are COM_RADIO_WHOLE_DEC, COM_RADIO_WHOLE_INC which adjust the whole digits and COM_RADIO_FRACT_DEC and COM_RADIO_FRACT_INC which normally change by 0.025Mhz increments. So they file would have to adjust that behaviour.

As an aside, how much fun is Javascript? I was adding 0.005 to the radio frequency and trying to set it but it wasn't working. Turns out I was using .toFixed(3) to read the number (because I saw it in one of the MSFS gauges and assumed it was just returning 3 decimal places) which converts it to a string and when I added 0.005 I was concatenating strings and trying to write that. OK, I can understand why that wouldn't work. What I can't understand is when I try to display the frequency I use floor and mod operators to isolate each digit and that works. How the hell does doing math functions on a string work? I miss C++.
 
Messages
1,047
Country
australia
Helpful .. I'm creating a string sValue "123450000" (to represent 123.45 NAV radio freq) and sending that
TransmitEvent(EventEnum.NAV1_RADIO_SET_HZ, sValue); with no result. A32NX

public /*static*/ void TransmitEvent(EventEnum cmd, string data) //STRING data
{
Byte[] Bytes = BitConverter.GetBytes(Convert.ToInt32(data));
UInt32 Param = BitConverter.ToUInt32(Bytes, 0);
try
{
simconnect.TransmitClientEvent(0, cmd, Param, GROUP.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
}
catch (Exception e)
{
DisplayStatusMessage("The Transmit Request Failed: " + e.Message);
}
}

Update: it actually works for a fraction of a second, then the radio flips back to the original freq.
I'd suggest that trying to set 123.450 to the NAV radio is not ideal as it is outside the normal range of NAV freqs. 108.000 to 117.975 is NAV. 118.000 to 136 (I think 135.975 is the max) is COM.

Now, I've found that you can set the radios to some weird numbers so maybe there is some other gauge in the aircraft that is validating the NAV frequency?
 
Messages
125
Country
unitedstates
thanks. It was working correctly, but I had the AI control of ATC turned on, so it was returning the frequency to what it wanted. I noticed a brief flash change of the frequency and figured out that it actually was working ...

update: The Com frequencies are working. The Nav frequency 1 is not, with no err messages. They are identical programming except for the event IDs , so I'm not sure why NAV 1 is failing.

NAV2_RADIO_SET_HZ works, is NAV1_RADIO_SET_HZ correct for the first?
 
Last edited:
Messages
1,047
Country
australia
thanks. It was working correctly, but I had the AI control of ATC turned on, so it was returning the frequency to what it wanted. I noticed a brief flash change of the frequency and figured out that it actually was working ...

update: The Com frequencies are working. The Nav frequency 1 is not, with no err messages. They are identical programming except for the event IDs , so I'm not sure why NAV 1 is failing.

NAV2_RADIO_SET_HZ works, is NAV1_RADIO_SET_HZ correct for the first?
NAV1_RADIO_SET_HZ is what I have in my js gauge

Code:
SimVar.SetSimVarValue("K:NAV1_RADIO_SET_HZ", "Hz", _currentFreq);

Notice the difference between COM_RADIO_SET_HZ and NAV1_RADIO_SET_HZ . The COM doesn't use 1, only for COM2 while NAV uses NAV1 and NAV2 (and I presume NAV3). I've only used COM and NAV1 so far in MSFS as that is what my radio has.

Have you tried SimConnect_SetDataOnSimObject? I used that a lot in FSX and P3D mainly because it works on variables that you can't set with event_ids such as fuel and payload data. Some variables you simply can't change (such as oil temperature).
 
Messages
125
Country
unitedstates
thanks , I did get this working, the little details are so important since the MSFS SDK doesn't give much information .. often there is no return value so I have to guess if the data request was valid and then the data format of the return can be unexpected. I have this working now. Where in the A32NX do we see the NAV frequencies displayed? Next I want to get the list of waypoints and do a DIRECT to one on a go around .. any help here? Thanks
 
Messages
162
Country
italy
my two cents:
I have tried to use NAV1_RADIO_SET_HZ with different approach on C++ without success,
could make it to work using execute_calculator_code.
Code:
// does not work
//error = trigger_key_event(KEY_NAV1_RADIO_SET_HZ, freq_to_be_set);
//this works
{            
char str[128] = "";
 sprintf(str, " %d (>K:NAV1_RADIO_SET_HZ)", freq_to_be_set);           
 error = execute_calculator_code(str, 0, 0, 0);    
}
 
Top