Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Peter,

I am currently writing software for some modules I have created, which are the ADF, COM, NAV avionics.

I have just finished the ADF coding which works perfect and I am now finalizing the COM radio code, but I have run into some problems unfortunately. The transfer button works flawlessly but I cant seem to write to the standby section of the radio frequency for some reason.The COM module does indeed read what is displayed in FSX.

FS verson: FSX

FSUIPC version: 4.32

FS Service Packs: SP1 & SP2

Here is a section that I used for writing to FS though FSUIPC

uiCOMData = 0;
            uiCOMData |= (InputPacketBuffer[7]<<12);
            uiCOMData |= (InputPacketBuffer[8]<<8);
            uiCOMData |= (InputPacketBuffer[9]<<4);
            uiCOMData |= InputPacketBuffer[10];

            //send COM1 Freq
            FSUIPC_Write(0x034E, 2, &uiCOMData, &dwResult);
            FSUIPC_Process(&dwResult); // Process the request(s)

            uiCOMStandbyData = 0;
            uiCOMStandbyData |= (InputPacketBuffer[3]<<12);
            uiCOMStandbyData |= (InputPacketBuffer[4]<<8);
            uiCOMStandbyData |= (InputPacketBuffer[5]<<4);
            uiCOMStandbyData |= InputPacketBuffer[6];

            //send COM1 stby Freq
            FSUIPC_Write(0x311A, 2, &uiCOMStandbyData, &dwResult);
            FSUIPC_Process(&dwResult); // Process the request(s)

            uiCOMTFRData = 0x0008;    //swap radios COM1


            FSUIPC_Write(0x3123, 1, &uiCOMTFRData, &dwResult);
            FSUIPC_Process(&dwResult); // Process the request(s)

Any help Peter on this matter would be greatly appreciated.

Kind regards

Padraig

Posted

I cant seem to write to the standby section of the radio frequency for some reason.

I suspect the data you are trying to send isn't valid. FSX ignores invalid values. Maybe your frequencies include the leading "1" and your references to characters [3]-[6] should really be [2]-[5], with the ignored "1"s in [1] and [6]? That's my guess.

Please always use the IPC write logging facility to check what is happening. I cannot debug your code here, you need to try using the facilities provided to debug your own programs. If you don't understand the log, show it to me.

Also enable Monitoring on the two COM1 frequency offsets, checking the "normal Log" option. this will then also log the SimConnect calls and responses.

BTW if this is real code, not just some extracts you've put together, it is very inefficient to make three Process calls to do this. You should be sending all the commands (reads and writes) you want in a cycle with one process call.

Regards

Pete

  • 1 month later...
Posted

Hi Peter,

Yes you were right about FSX reading invalid values, the problem was that, I had simply forgot that the NAV, COM, etc, radios only use a limited bandwidth range. The numbers I was trying to operate were not in that range. Also, thanks for the input about the process clean up code. The sample below was simply a rough guideline to get the firmware operating with FSUIPC. The code was cleaned up later on.

Kind regards

Padraig

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.