Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Pete,

When writing a Lua program I found the ADF2 swap code 66742 was swapping ADF1 frequencies instead of ADF2 frequencies. So as a further check I used FSUIPC to assign a key to the ADF2 Radio Swap control and confirmed ADF1 in default FSX a/c was getting swapped by the ADF2 swap control.  Using FSUIPC4.949k, FSX Deluxe, Win7/64.

Thanks,

Al

  • 2 weeks later...
Posted

When writing a Lua program I found the ADF2 swap code 66742 was swapping ADF1 frequencies instead of ADF2 frequencies. So as a further check I used FSUIPC to assign a key to the ADF2 Radio Swap control and confirmed ADF1 in default FSX a/c was getting swapped by the ADF2 swap control.  Using FSUIPC4.949k, FSX Deluxe, Win7/64.

 

FSUIPc merely sends that control number to FS. It cannot change what it does. And the list of control names is generated from the list in FS's "CONTROLS.DLL".

 

So it would seem you have found an original FSX bug -- possibly FS9 and before too? Too late to get Microsoft to fix it, but maybe you should report it to DoveTail Games for FSX-SE and to Lockheed-Martin for P3D?

 

Pete

Posted

FSUIPc merely sends that control number to FS. It cannot change what it does. And the list of control names is generated from the list in FS's "CONTROLS.DLL".

 

So it would seem you have found an original FSX bug -- possibly FS9 and before too? Too late to get Microsoft to fix it, but maybe you should report it to DoveTail Games for FSX-SE and to Lockheed-Martin for P3D?

 

Pete

 

If not too inconvenient, would you consider providing offsets for the ADF2 standby frequency as you do for the primary frequency? With that anyone needing to swap ADF2 frequencies could write their own Lua ADF2 swap function.

Thanks,

Al

Posted

If not too inconvenient, would you consider providing offsets for the ADF2 standby frequency as you do for the primary frequency? With that anyone needing to swap ADF2 frequencies could write their own Lua ADF2 swap function.

 

Actually, there are no offsets for either ADF standby frequencies. I don't think they could have been supported in earlier versions of FS. Either that or no one was ever interested in the enough to ask.

 

I'll add them soon, in another Interim update. I'll let you know in this thread. Maybe before the weekend.

 

I find no way to WRITE them documented in the SimConnect SDKs though. For the main frequencies I use KEY_ADF_COMPLETE_SET and KEY_ADF2_COMPLETE_SET. How would you set the standby values? It looks like I'll just have to make them read only!

 

Pete

Posted

Thanks very much for considering my request, but if there is no way to write the standby frequencies like there is for the Nav or Comm radios, then it is probably not worth your time to develop the offsets.

Al

Posted

Thanks very much for considering my request, but if there is no way to write the standby frequencies like there is for the Nav or Comm radios, then it is probably not worth your time to develop the offsets.

 

How were you using the standby ADF frequencies in any case?

 

Pete

Posted

How were you using the standby ADF frequencies in any case?

 

Pete

I wrote a set of Lua Scripts (the NpC program under FSUIPC User Contributions) that among other things lets users enter radio frequencies directly from the keyboard instead of having to use less convenient (in my opinion) mouse clicks. The X key is then used to swap the standby and active frequencies of the target radio. The Learjet35A by Flysimware has two ADF radios with standby frequency capability, so I was modifying the NpC code for those ADFs when I came across the swap control bug for ADF2 (almost none of the default FSX a/c have two ADFs).  Interestingly, and perhaps a side effect of the control code swap bug for ADF2, when a frequency is entered into ADF1 of the Lear35A it goes in standby as expected, but when a frequency is entered into ADF2 it directly becomes the active frequency. You can then swap it into a standby position with a mouse click, but how that is done given the swap control bug I don't understand. I tried to use Lvars to implement the swap without success. I will go back and try that approach again.  In any case, if we have to live with mouse clicks for swapping ADF2 I suspect the world won't end as a result!

I sincerely appreciate your efforts to help the FS community when possible.

Al

Posted

Interestingly, and perhaps a side effect of the control code swap bug for ADF2, when a frequency is entered into ADF1 of the Lear35A it goes in standby as expected, but when a frequency is entered into ADF2 it directly becomes the active frequency. You can then swap it into a standby position with a mouse click, but how that is done given the swap control bug I don't understand.

 

Please enable Event logging in FSUIPC and try that so we can see if any standard events are used.

 

Pete

Posted

Pete,

 

I toggled the frequencies of ADF2 back and forth a few times. It looks like from the event log below they are using the ADF2_COMPLETE_SET control that you mentioned previously rather than the ADF2 frequency swap code. I am unfamiliar with ADF2_COMPLETE_SET but it looks like the Param shown with each ADF2_COMPLETE_SET event is the new active frequency, ie., the frequencies being swapped below were 0240.0 and 0350.0. The Param value seems to be the decimal frequency interpreted as a hexadecimal value??

Al

 

 

Event Log segment:

 

   231053 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231131 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231131 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 37748736 (0x02400000) ADF2_COMPLETE_SET
   231193 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231256 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231287 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231349 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231412 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231443 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231521 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231583 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231614 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231677 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231739 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231802 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231833 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231911 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   231973 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232004 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232067 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232129 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232192 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232192 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 55574528 (0x03500000) ADF2_COMPLETE_SET
   232223 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232301 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232363 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232394 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232457 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232519 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232582 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232613 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232691 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232753 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232784 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232847 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232909 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   232972 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233003 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233081 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233143 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233174 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233174 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 37748736 (0x02400000) ADF2_COMPLETE_SET
   233237 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233299 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233330 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233393 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233471 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233533 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233564 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233627 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233689 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233720 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233783 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233861 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233923 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   233954 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234017 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234079 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234110 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234173 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234173 Monitor IPC:024C (S32) = 2027216
   234204 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 55574528 (0x03500000) ADF2_COMPLETE_SET
   234251 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234313 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234344 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234407 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   234469 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET

Posted

I toggled the frequencies of ADF2 back and forth a few times. It looks like from the event log below they are using the ADF2_COMPLETE_SET control that you mentioned previously rather than the ADF2 frequency swap code. I am unfamiliar with ADF2_COMPLETE_SET but it looks like the Param shown with each ADF2_COMPLETE_SET event is the new active frequency, ie., the frequencies being swapped below were 0240.0 and 0350.0. The Param value seems to be the decimal frequency interpreted as a hexadecimal value??

 

I know how to use the ADF2_COMPLETE_SET control. They are simple decimal Hz. decimal That's no problem. But what does the swapping? Are you clicking a button on screen? Is the value in the control the one which was in the STBY frequency display or the current one?

 

Pete

Posted

I know how to use the ADF2_COMPLETE_SET control. They are simple decimal Hz. decimal That's no problem. But what does the swapping? Are you clicking a button on screen? Is the value in the control the one which was in the STBY frequency display or the current one?

 

Pete

You click a button on the radio to swap frequencies, and the Param value is the new active frequency you get as a result of the swap, or in other words, the Param value was the standby frequency before the swap.

Al

PS: You sure are up late!

Posted

Pete,

The below log segments are the result of two clicks of the ADF2 swap button, one right after the other. I only included segments where ADF2 was involved. Thought seeing the Lvars might help.

 

Log segments:

 

   200867 LUA.1: L:COM_ON=1
   200867 LUA.1: L:ADF2_Standby_Freq=444.4
   200867 LUA.1: L:SLAVE_FREE1=0
............................................................................................
   201476 LUA.1: L:NAV=0
   201476 LUA.1: L:VarAdf2=0
   201476 LUA.1: L:GPS_GROUP_KNOB_3WAY=0

...................................................................................................................

   203738 LUA.1: L:Stopwatch Last Abs Time2=63596082677.168
   203785 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 71581696 (0x04444000) ADF2_COMPLETE_SET
   203785 LUA.1: L:Stopwatch Last Abs Time=63596082677.168
   203816 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   203816 LUA.1: L:VarAdf2=1
   203863 LUA.1: L:ADF2_Standby_Freq=555.5

   203878 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
.....................................................................................................................................................................
   206546 LUA.1: L:RAINMOVINGTIMER=9
   206577 *** EVENT: Cntrl= 66556 (0x000103fc), Param= 89477120 (0x05555000) ADF2_COMPLETE_SET
   206577 LUA.1: L:Stopwatch Last Abs Time2=63596082679.946
   206608 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   206608 LUA.1: L:Stopwatch Last Abs Time=63596082680.002
   206639 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET
   206639 LUA.1: L:VarAdf2=0
   206686 LUA.1: L:ADF2_Standby_Freq=444.4

   206717 *** EVENT: Cntrl= 65568 (0x00010020), Param= 0 (0x00000000) HEADING_GYRO_SET

 

I did a few experiments. Changing the value of L:VarAdf2 from 1 to 0, or vice versa, animates the movement of the ADF2  toggle swap switch, but does not actually make the active and standby frequencies swap. Writing a frequency to   L:ADF2_Standby_Freq loads the frequency into the ADF2 standby frequency display. You can also read L:ADF2_Standby_Freq.  All this happens without using the 66556 control code.  I tried ipc.control(66556, 0) to initiate a frequency swap but nothing happened. Perhaps you need to use a particular parameter with the 66556 control code to initiate the swap?

 

So if I can read and write the standby frequency using L:ADF2_Standby_Freq, and the active frequency using the FSUIPC offsets, it seems like I should be able to write my own swap routine.  I will give that a try, but I'd sure like to know how ADF2_COMPLETE_SET makes the swap happen.

 

 

Also, here is a segment from the aircraft.cfg file. Note that ADF.1 has two parameters after it (two ones) but ADF.2 only one parameter.  From what I've been able to learn, and as noted below, it is that second parameter that tells the sim to send all tuning commands to the standby slot rather than the active slot.   If I write to the ADF1 frequency offsets, it is the standby frequency that gets loaded. And if I write to the ADF2 frequency offsets, it is the active frequency that gets loaded. All of which seems consistent with the parameters.  However, if I tune ADF2 in the sim using the mouse, it is the standby frequency that gets tuned, which seems counter to the parameter configuration. And how the lack of the second parameter for ADF.2 plays into the swapping issue, if at all,  I don't know.

 

[Radios]
// Radio Type = availiable, standby frequency, has glide slope
Audio.1       = 1
Com.1         = 1, 1
Com.2         = 1, 1
Nav.1         = 1, 1, 1
Nav.2         = 1, 1, 1
Adf.1         = 1, 1
Adf.2         = 1 

Transponder.1 = 1
Marker.1      = 1
DME.1         = 1
DME.2         = 1

 

 

Al

Posted

The below log segments are the result of two clicks of the ADF2 swap button, one right after the other. I only included segments where ADF2 was involved. Thought seeing the Lvars might help.

 

Interesting, but I'm not sure how useful it is. L:Vars are specific to the gauges which are part of the add-on aircraft. It looks like they've implemented parts of the ADF2 logic using L:Vars, probably because of the lack of proper support in FS. In other words, it's a work-around.

 

 I tried ipc.control(66556, 0) to initiate a frequency swap but nothing happened. Perhaps you need to use a particular parameter with the 66556 control code to initiate the swap?

 

No. That is bound to be the actual frequency in Hz in BCD format. Values not in the correct range for ADFs will just be ignored.

 

I would experiment here, but there is no default aircraft with two ADFs both with standby's as far as I know. I'll see what else I can do. Maybe reading the standby frequency, then using ADF2 Complete Set with the value can solve the lack of a swap control, and reading the active, using Complete Set with the new standby value, THEN using it again with the saved active will do the job of ADF2 standby complete set.

 

First I shall get the standby frequencies into offsets, then perhaps you could try that logic there, since you have such an aircraft?

 

Pete

Posted

Okay. I've added offsets to read both ADF2 active and standby frequencies, but there's no way to change the standby ADF2 value. The aircraft you are using has a workaround to do the swap. That doesn't apply in general. The ADF2 complete set control only sets the active and you can't swap because the swap control doesn't work.

 

I've tried all sorts of fiddles to make it work, but unless you have an add-on which has been coded to do it some other way, as you have, then the ADF2 standby is a wasted resource.

 

I've reported it to L-M and can only hope they fix the Rado Swap control, at least. There are vacant slots in the controls table, so maybe some of those might do the ADF1 and 2 standby complete sets,, but I doubt it. I haven't the time or patience to try them all, just in case!

 

If you think it might be useful I can let you have the version of FSUIPC4 with the new offsets, but otherwise it will simply be part of the next release, whenever.

 

Pete

Posted

I've just released FSUIPC 4.949n. This contains support for reading (only) the ADF standby frequencies. Details are in the accompanying "Changes" PDF, but here they are too:

72.    Additional offsets are now provided for the ADF standby frequencies, as follows:
         0284             2 bytes      ADF1 Standby Frequency: main 3 digits, in Binary Coded Decimal.
                                         A frequency of 1234.5 will have 0x0234 here and 0x0105 in offset 0286.
         0286             2 bytes      Extended ADF1 standby frequency. The high byte contains the 1000’s digit and the low byte the fraction,
                                         so, for a frequency of 1234.5 this offset will contain 0x0105.
         0288             2 bytes      ADF2 Standby Frequency: main 3 digits, in Binary Coded Decimal.
                                         A frequency of 1234.5 will have 0x0234 here and 0x0105 in offset 028A.
         028A             2 bytes      Extended ADF2 standby frequency. The high byte contains the 1000’s digit and the low byte the fraction,
                                         so, for a frequency of 1234.5 this offset will contain 0x0105.
         Note that there appears to be no way to actually write to the standby frequencies, so writing these offsets will do nothing except mess up the last value read. If this can be fixed at some time, it will be. Additionally the ADF2 radio swap control appears to be broken – it swaps the ADF1 frequencies instead of ADF2. This applies to FSX, FSX-SE and P3D at least up to version 3.2.

Pete
 

Posted

Pete,

 

Thanks very much for the generous support. I will download FSUIPC 4.949m and take a shot at writing a swap routine using the Lvars for this particular a/c and the offsets to make it work.

If I should stumble on a solution that is not Lvar dependent, I'll report back here. By any chance can you point me towards a resource that details the use of the ADF2 complete set control to read and write ADF frequencies?

 

Best,

Al

Posted

If I should stumble on a solution that is not Lvar dependent, I'll report back here. By any chance can you point me towards a resource that details the use of the ADF2 complete set control to read and write ADF frequencies?

 

The ADF complete set control is a SimConnect Event, so documented in the Simconnect SDK. Like all controls it only writes, not reads. The parameter is the frequency value in Hz, in BCD format (Binary Coded Decimal -- like the offsets), as you saw in your logging.

 

Pete

Posted

Hi,

 

Anyhow you should try to set the second parameter in the [radios] section of your aircraft.cfg for ADF2 to 1. Because the second parameter typically defines, if there is a standby frequency available.

 

This is only specified in the SDK for COM1 and COM2: "Two flags, set the first one to 1 if a Com1 radio is available, and the second if it supports a standby frequency."

But I have seen this in other aircraft also set for ADF1 and ADF2.

 

Rgds

Reinhard

Posted

Anyhow you should try to set the second parameter in the [radios] section of your aircraft.cfg for ADF2 to 1. Because the second parameter typically defines, if there is a standby frequency available.

 

This is only specified in the SDK for COM1 and COM2: "Two flags, set the first one to 1 if a Com1 radio is available, and the second if it supports a standby frequency."

But I have seen this in other aircraft also set for ADF1 and ADF2.

 

Good idea.  I have the Prosim 738 which has this. That's where I tested. But no gauges as instrumentation is provided by Prosim. So I tested using the offsets.  However, I looked in the Aircraft.CFG and it doesn't have a standby value for either ADF.

 

I'll test again, but I have no expectations -- the swap ADF1 control works on ADF1 in any case, ad the swap ADF2 swaps ADF1 too. I'm pretty sure it's an old FS bug carried forward all this time.

 

[LATER]

Confirmed. Changing the Aircraft.CFG appropriately doesn't help. ADF2 Radio Swap still swaps ADF1 frequencies, not ADF2.

 

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.