Jump to content
The simFlight Network Forums

We'll need offsets for 8.33kHz radios


activex

Recommended Posts

  • 4 weeks later...

The Hz/int offsets are already working for reading, for writing a 8.33 frequency I'm using a workaround by setting the frequency to the nearest lower 25kHz frequency via the standard radio offsets and then calling the control for radio increase until it matches the correct 8.33 frequency. This works quite well.

Simplified example based on C#, but should be easily adaptable to LUA or any other language:

double freq = 122.385; // example freq
int freqKhz = (int)(freq * 1000); // 122385
int nextSmaller25 = (freqKhz / 25) * 25; // 122375
int remainder25 = freqKhz % 25; // 10
int steps = remainder25 / 5; // 2
if (nextSmaller25 >= 118000 && nextSmaller25 < 137000 && steps <= 3 && remainder25 % 5 == 0) // is valid 8.33 freq?
{   
    string legacy4digit = nextSmaller25.ToString().Substring(1, 4); // 2237
    => write legacy4digit as BCD to COM offset (e.g. to 0x311A for COM1 standby)
    for (int i = 0; i < steps; i++) // 2 times
    {
        => call control for radio fract increase, e.g. 65639 (COM_RADIO_FRACT_INC) for COM1
    }
}

 

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...

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.