Jump to content
The simFlight Network Forums

Lua script to set the COM1 standby frequency (FSUIPC6 and P3Dv5)


Isak

Recommended Posts

*** Moved from FSUIPC7 / MSFS sub-forum to main support forum ***

Hi everyone,

I’m currently working on a small Arduino project that allows me to input a radio frequency using a keypad. The frequency is displayed on an LCD screen. For example, if I type 120.800 and press the "#" key, the following appears in the serial monitor:

COM1SB 120.800

What I want to achieve is setting the COM1 standby frequency in the simulator. I believe I’ll need to write a Lua script to detect the string "COM1SB", extract the frequency, and send it to the simulator using ipc.control.

Am I correct that 66371 (COM_STBY_RADIO_SET) is the right ipc.control command to use? Could someone share an example of a Lua script that would accomplish this?

Best regards,
Isak

 

Edited by John Dowson
Moved to main support forum, key file removed
Link to comment
Share on other sites

  • Isak changed the title to Lua script to set the COM1 standby frequency (FSUIPC6 and P3Dv5)

First, you posted in the sub-forum for FSUIPC7 / MSFS - please use the main forum for all other versions of FSUIPC, not the specific sub-forum for FSUIPC7.
You also attached the trial license/key file for FSUIPC7 for some reason...I have removed that.

16 hours ago, Isak said:

Am I correct that 66371 (COM_STBY_RADIO_SET) is the right ipc.control command to use? Could someone share an example of a Lua script that would accomplish this?

Yes, that is the correct control/event, but be aware that the parameter for that control is in BCD16 format (Binary-encoded decimal), so to set to 120.80 you would use:
     ipc.control(66371, 0x2080)
(the leading 1 is assumed).

17 hours ago, Isak said:

I believe I’ll need to write a Lua script to detect the string "COM1SB", extract the frequency,

That is the difficult bit. You would need to register a function to receive key presses (using the event.key function) for the keys 'C'. 'O', 'M'. '1', ' ', 'S', 'B', ',' , and all the digits, then keep track of everything entered and in the correct order....I really can't recommend doing it this way....

Maybe take a look at this user' contribution, which is a lua script to allow keyboard entry for radios (as well as obs and AP). Its for FSUIPC4, but should work with FSUIPC5, although some small modifications may be needed: 

 

 

John

Link to comment
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
×
×
  • 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.