bpollock

Active Com1 frequency

Recommended Posts

Is there a way to use linda or lua to constantly monitor the active Com1 frequency and write it to a simple text file.  The file would simply get overwritten when a new active com1 frequency is selected?

 

Thanks

Brian

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Brian

There is but what do you intend to do with the file data? There may be a more efficient way of passing through data to another process. 

Share this post


Link to post
Share on other sites

I'm an old school visual foxpro programmer.  When the com freq is changed, my VFP app needs to read it and then continue processing.  I wrote a VB app a while back that would grab FS data to a text file for VFP to process it, but I lost the source code.   

 

Actually, remembering back, I think my VB app would put FS data into the keyboard buffer and my VFP app would read the buffer and continue processing   

 

Im not that good of a VB programmer to do all of it, hence the passing to VFP

 

I tried using fsuipc to log the com changes but the log file only gets updated when fsuipc is closed.  

Share this post


Link to post
Share on other sites

Hi Brian

This should do what you wanted. Copy code into: \linda\libs\lib-user.lua or \linda\aircrafts\{your aircraft}\user.lua.

function myCOM1(val)
    local strFreq = strFreq(getCOMFrequency(1, false))
    _loggg('[LIBU] Com1=' .. strFreq)
    file = io.open ("vps.txt", "w+")
    io.output(file)
    io.write(strFreq)
    io.close(file)
end

event.offset(0x034E, "UW", "myCOM1")

It runs only when the COM1 is changed and writes the string to file vps.txt. You can change the filename to suit your needs. If you place the code into lib-user.lua then it will work will all your aircraft whereas the user.lua is for the specific aircraft.

Share this post


Link to post
Share on other sites

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