Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Toggle Button for a Control Event

Featured Replies

Hey guys,

after searching a lot I still did not find a solution. I would like to read a control event paramater, and depending on this parameter value, I would send an control event.

Example: The COM1 audio panel can be selected to On with the Control Event 66964, Parameter 1, and to Off with Parameter 0. What would be the correct syntax for programming? I have used this but it does not work:

function COM1_RECEIVER_toggle ()
    COM1_receiver_state = read ipc.control("66964") -> I know this is wrong and I didn't find the correct syntax how to read a parameter of a given control event
    if COM1_receiver_state == 1 -> if the COM1 Audio is On
    then
    ipc.control("66964", 0) -> set COM1 Audio to Off
    else
    ipc.control("66964", 1) -> set COM1 Audio to On (if Off before)
end

So when I assign a button, it should switch the COM1 Audio to On from Off or Off from On, depending on the given state. Off course, the same principle would be for COM 2, so that I can switch them independently On or Off (e.g. COM1 On with ATC, COM2 temporarily On to listen to ATIS, but not deactivating COM1).

The COM_RECEIVE_ALL_TOGGLE Event 66465 is not the goal for me as I wish to selectively and independently listen to COM1 and COM2.

Off course, this principle would be the same for any MSFS 2020 Control Event with On and Off states and non existing toggle function.

Thank you very much for your help and many greetings from

Robert!

Hi @drpernar, many of the radio functions are built into LINDA through the VRI MCP radio panel. Most are hard coded but can be found in common.lua (search Default_RADIOS_) and in Library lib-MSFS.lua.

One point I would make is that FSUIPC Controls are Events which can only initiate an action and sometimes provide parameter. They can not be used to read a status or value. This is done using the FSUIPC Offsets as documented in the FSUIPC Document folder.

The LINDA Tracer provides useful tools for testing controls and offsets.

Edited by ScotFlieger

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author

Hi!

Thanks for your advice, I'll try to figure out how it goes with this offsets...But to be honest, the FSUIPC docs, especially the advanced guide, are didactically not appealing, at least for me. 

Where would you recommend to read the basics and the usage of offsets with easy examples, this has not to be the original FSUIPC documents? 

Greetings from Robert!

Welcome to the wonderful world of programming. I can’t point you to any guide on the use of offsets. The only reference is the Offset Listing in the FSUIPC7 Documents folder. I can only suggest you look at examples in the LINDA LUA code and experiment with the LINDA Tracer tool.    

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author

Thank you very much, I'll do my best and give an update for this COM toggle switch, whenever I find a solution.

  • Author

I have found a solution for the COM1 + COM2 Listen to Audio Toggle Switches:

function COM1_RECEIVE_toggle ()
    com2_receive_status = ipc.readUB(0x3122)
    if com2_receive_status == 164 
    then
    ipc.control("66964", 0)
    else
    ipc.control("66964", 1)
    end
end


function COM2_RECEIVE_toggle ()
    com2_receive_status = ipc.readUB(0x3122)
    if com2_receive_status == 132 
    then
    ipc.control("66965", 1)
    else
    ipc.control("66965", 0)
    end
end

I was only able to find the offset value for COM2 (0x3122 with 132 = Off, and 164 = On) with LINDA Tracer, but not for COM1 (only God knows about this offset value ;-)). Nevertheless, it makes only sense to deactivate the COM1 Listen mode when COM2 Listen mode is activated before. So with this offset value for COM2 I can manage 2 toggle switches.

I am using this code for the Carenado PA44 Seminole GARMIN GMA 340 Audio Panel COM1 + 2 Buttons within MSFS 2020.

Keep coding and greetings from

Robert!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.