June 21, 20223 yr 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!
June 22, 20223 yr 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 June 22, 20223 yr 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
June 23, 20223 yr 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!
June 23, 20223 yr 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
June 24, 20223 yr Author Thank you very much, I'll do my best and give an update for this COM toggle switch, whenever I find a solution.
June 26, 20223 yr 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.