MD80PROJECT Posted July 9 Report Posted July 9 Good morning friends. It is a pleasure to be able to greet you again. Today I would like to ask if any of you know how to find a certain offset for the indicator light. I need to find many indicator lights. I am using LINDA Tracer with LINDA Console to be able to observe how they react to the Lvar variables and see their values depending on when an indicator light turns on or off. In this case as an example I am looking for a GPWS indicator light on MADDOG X, the variable is: Lvar: CM1_egpws_on_adv1= 0 or 1 I want to identify the offset where this Lvar is saved so I can program it with mobiflight can anybody help me. I also want to apologize for my lack of experience but I am learning little by little and I cannot dedicate as much time as I would like to this project. Thank you very much and happy day greetings
John Dowson Posted July 9 Report Posted July 9 First, what version of FSUIPC and what simulator are you using? 1 hour ago, MD80PROJECT said: I want to identify the offset where this Lvar is saved so I can program it with mobiflight For information on offsets, please see the FSUIPC Offset status document for your version of FSUIPC. However, there will be no offset holding that lvar value. FSUIPC does not hold any lvar values in offsets by default. If you want to add an lvar to an FSUIPC offset, you can do that but it doesn't happen by default. In FSUIPC7, you can use an [LvarOffsets] section of the FSUIPC ini file - see the Advanced user guide for details. For other versions of FSUIPC you would have to use a lua script. The script should wait for the lvar value to change (event.lvar) and in the handling function, write the value to a free/spare FSUIPC offset. But if using MobiFlight, doesn't that have access to lvars without using FSUIPC? John
MD80PROJECT Posted July 9 Author Report Posted July 9 Thank you very much for answering John, you are always attentive and I appreciate it. I use FSUIPC6. You mean to use a script.lua to read if the value of Lvar: CM1_egpws_on_adv1 changes state, and store the value in a free/spare FSUIPC offset, is that correct? For example: function egpws_on_adv1 (varname, value) ipc.writeUD(0x0000, value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") but I need to know what the free/spare FSUIPC offset list is to be able to use, and replace (0x ? ? ? ? ) with a free/spare offset, can you tell me where I can get this list? Once stored in a free/spare FSUIPC offset value, configure it with mobiflight to turn the LED on or off according to the value of the new free/spare FSUIPC offset, is that correct? thank you very much john
John Dowson Posted July 9 Report Posted July 9 58 minutes ago, MD80PROJECT said: I use FSUIPC6. You mean to use a script.lua to read if the value of Lvar: CM1_egpws_on_adv1 changes state, and store the value in a free/spare FSUIPC offset, is that correct? For example: function egpws_on_adv1 (varname, value) ipc.writeUD(0x0000, value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") but I need to know what the free/spare FSUIPC offset list is to be able to use, and replace (0x ? ? ? ? ) with a free/spare offset, can you tell me where I can get this list? Yes, that looks correct. Check the FSUIPC Offset status document for a free offset, e.g. there are 512 bytes free starting at 0xA000 1 hour ago, MD80PROJECT said: Once stored in a free/spare FSUIPC offset value, configure it with mobiflight to turn the LED on or off according to the value of the new free/spare FSUIPC offset, is that correct? No. Your lua script is only for reading at the moment. If you want to update the lvar when you update the offset, you have to have that as well. So you need to add an event.offset call (on the offset you use) and in the handling function you can set the lvar value. Before you set the value, check it was not the value received and written to the offset, e.g. store the lvar value in a local script variable when received and check its different from the offset value when that changes before you use it to set the lvar value.
MD80PROJECT Posted July 10 Author Report Posted July 10 (edited) thank you very much for your response sir Dowson. I'm going to explain to you what I tried to do today. In that case I can memorize the value of Lvar: CM1_egpws_on_adv1 in any of these free spaces that I show you below: 0x66C0 - 0x66FF: 64 bytes 0x0D70 - 0x0DFF: 144 bytes 0x0FA0 - 0x0FFF: 96 bytes 0x3C00 - 0x3FFF: 1024 bytes 0x5200 - 0x53FF: 512 bytes 0x5400 - 0x55FF: 512 bytes 0x5600 - 0x56FF: 256 bytes 0x5700 - 0x57FF: 256 bytes 0x5C00 - 0x5FFF: 1024 bytes 0x7000 - 0x7FFF: 4096 bytes 0x8000 - 0x83FF: 1024 bytes 0x8400 - 0x87FF: 1024 bytes 0x8800 - 0x88FF: 256 bytes it's right ? In that case, my intention is to use the following code, to save the value of CM1_egpws_on_adv1 in a free offset, for example using the offset 0x8804. function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x8804 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") Once this code has been created, assigned the free offset where I want to save the value, I want to save a .lua file called egpws_on_adv1.lua, in the FSUIPC6 raid folder, C:\Users\Jose Maria\Documents\Prepar3D v5 Add-ons\ FSUIPC6, and then rewrite (14=egpws_on_adv1) in the FSUIPC6.ini file, in the [Auto] section, remaining as follows: [Auto] 1=PitotHeat 2=Lua MADDOG_X 3=Lua CM1_mastercaut_adv1 4=Lua CM1_masterwarn_adv1 5=Lua ovhd_apu_bus 6=Lua eoap_a_adv1 7=Lua ovhd_emerg_pwr_adv1 8=Lua CM1_alt_adv1 9=Lua eoap_door 10=Lua eoap_ice 11=apu_L_bus 12=ext_pwr_L_bus 13=ovhd_pa 14=egpws_on_adv1 After all this through mobiflight, I am trying to interrogate the offset 0x8804 to turn on the LED. But I have no success and I don't know what I could be doing wrong in trying to make it work. Can you perceive any error in the sequence??? thank you so much. Edited July 11 by John Dowson MobiFlight screenshot removed
John Dowson Posted July 11 Report Posted July 11 11 hours ago, MD80PROJECT said: in any of these free spaces that I show you below: 0x66C0 - 0x66FF: 64 bytes 0x0D70 - 0x0DFF: 144 bytes 0x0FA0 - 0x0FFF: 96 bytes 0x3C00 - 0x3FFF: 1024 bytes 0x5200 - 0x53FF: 512 bytes 0x5400 - 0x55FF: 512 bytes 0x5600 - 0x56FF: 256 bytes 0x5700 - 0x57FF: 256 bytes 0x5C00 - 0x5FFF: 1024 bytes 0x7000 - 0x7FFF: 4096 bytes 0x8000 - 0x83FF: 1024 bytes 0x8400 - 0x87FF: 1024 bytes 0x8800 - 0x88FF: 256 bytes it's right ? No! Why do you think that? For example, 0x0D70 is the area for Macro and Lua requests, as it states in the FSUIPC6 Offset Status document: Quote 0D70 128 Macros and Lua requests Write here the complete identity string of a Macro control or Lua program control in order to have FSUIPC execute it. For a Macro, the string should begin with up to 16 characters giving the .MCRO file name (just the name part, not the type), and then, separated by a ‘:’ character, the macro name within that file—again, up to 16 characters. Spaces either side of the ‘:’ are optional. ... Please see that document, and you can use offsets in areas designated as Free for general use. 11 hours ago, MD80PROJECT said: In that case, my intention is to use the following code, to save the value of CM1_egpws_on_adv1 in a free offset, for example using the offset 0x8804. function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x8804 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") Thats fine and will store the value of the lvar in the offset (for reading ONLY), except that offset 0x8804 is NOT free for general use. Please DO NOT use offsets that are not documented as free for use as this may cause issues. 11 hours ago, MD80PROJECT said: want to save a .lua file called egpws_on_adv1.lua, in the FSUIPC6 raid folder What is a 'raid folder'? All lua scripts should go in your FSUIPC6 installation folder, or the folder specified by LuaPath if using that. 11 hours ago, MD80PROJECT said: in the [Auto] section, remaining as follows: [Auto] 1=PitotHeat 2=Lua MADDOG_X 3=Lua CM1_mastercaut_adv1 4=Lua CM1_masterwarn_adv1 5=Lua ovhd_apu_bus 6=Lua eoap_a_adv1 7=Lua ovhd_emerg_pwr_adv1 8=Lua CM1_alt_adv1 9=Lua eoap_door 10=Lua eoap_ice 11=apu_L_bus 12=ext_pwr_L_bus 13=ovhd_pa 14=egpws_on_adv1 Entries with indices 1m11,12,13 & 14 are ALL incorrect. Lua scripts in this section MUST be preceded by Lua, as are the entries with indices 2,3,4,5,6,7,8,9. 11 hours ago, MD80PROJECT said: I am trying to interrogate the offset 0x8804 to turn on the LED. You can interrogate (i.e. read) the offset to get the status of the LED, but you cannot control it as the offset will be read-only, as you have not added any lua code to handle a write/update. Please do not attach images, especially of MobiFlight which I do not support. I will remove that.
MD80PROJECT Posted July 13 Author Report Posted July 13 Ok, I just made a dumb assumption and I was wrong, sorry for the inconvenience for thinking the list of comps I showed you were free. After reviewing the FSUIPC6 document he only discovered that the only offsets thought to be free with the offsets (66C0 Free for general use, for example in programming buttons or keys.), these free offsets, I already have them in use in Maddog X from Roman Stoviak "spokes2112" to whom I greatly appreciate his efforts for this great document. So my problem comes because I don't know how to locate more free offset in the FSUIPC6 document to continue configuring more indicator lights that I need. As I have told you, my intention is to find many more free offsets to be able to use and configure, store the value in said free offset, and then interrogate and turn on the LED through mobiflight. So I need to know how to find and identify more free offsets so I can continue working with them, if you can help me with this it would be great. I also apologize for posting the mobiflight image, I didn't mean to bother you at all, I apologize very much on my behalf, I'm sorry. In the [Auto] section I have already corrected the errors and now everything follows the sequence 1=Lua..... as indicated. thank you Greetings and thank you very much Mr. Dowson. MADDOG_X.lua
John Dowson Posted July 13 Report Posted July 13 3 hours ago, MD80PROJECT said: After reviewing the FSUIPC6 document he only discovered that the only offsets thought to be free with the offsets (66C0 Free for general use, for example in programming buttons or keys.), these free offsets, I already have them in use in Maddog X from Roman Stoviak "spokes2112" to whom I greatly appreciate his efforts for this great document. So my problem comes because I don't know how to locate more free offset in the FSUIPC6 document to continue configuring more indicator lights that I need. Sorry, but I do not understand this. If I search for free offsets in the offset document, I find these: Quote 66C0 64 Free for general use, for example in button or keys programming. 7C40 704 Free for general use A000 512 Free for general use, for example in button or keys programming This is for FSUIPC6 v6.1.5 and later. The official release is now 6.2.0. If you are using an older version, please update. Is that not enough space to use? If not, then you van use offsets assigned to other things (i.e. 3rd party software such as the PMDG offsets). But please at least first use the offsets available. If then you run out of space, I van let you know which other offsets to use (documented in FSUIPC7, but not yet in FSUIPC6). John
MD80PROJECT Posted July 14 Author Report Posted July 14 I must be doing something wrong: Please upgrade to the latest version of FSUIPC6.2 this morning. In the new list of FSUIPC_Offsets_Status, it does not appear, 7C40 704 Free for general use A000 512 Free for general use, for example in button or keys programming I have tried to turn on the LED with ( L:CM1_egpws_on_adv1 ) and replacing the offset with 7C40, A000, 66C0 and consecutive hexadecimal numbers 7C44, 7C48......, A004, A008........ , 66C4, 66C8.........., etc. I have only gotten it to work with offsets 0x6700, 0x6704, and 0x6800 IT DOES NOT WORK function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x7C40 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") IT DOES NOT WORK function egpws_on_adv1 (var_name, value) ipc.writeUD( 0xA000 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") IT DOES NOT WORK function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x66C0 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") WORKS function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x6700 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") WORKS function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x6704 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") WORKS function egpws_on_adv1 (var_name, value) ipc.writeUD( 0x6800 , value) end event.Lvar("L:CM1_egpws_on_adv1", 100, "egpws_on_adv1") Obviously through mobiflight, I have also substituted the call offset values for the code. Also in the FSUIPC6.ini file is the [Auto] section. It is properly written. I can't understand why it doesn't work.🙁 Greetings and thank you very much Mr. Dowson.
John Dowson Posted July 14 Report Posted July 14 1 hour ago, MD80PROJECT said: I have only gotten it to work with offsets 0x6700, 0x6704, and 0x6800 Offset area 6700 - 6BFF (1632 bytes) are ok to use if not using Jean-Michael Biston ("Michael") for Airbus gauges or FS-Communicator, which is what they are reserved for. 1 hour ago, MD80PROJECT said: I have tried to turn on the LED with ( L:CM1_egpws_on_adv1 ) and replacing the offset with 7C40, A000, 66C0 and consecutive hexadecimal numbers 7C44, 7C48......, A004, A008........ , 66C4, 66C8.........., etc. Note that your lua WILL NOT turn on the LED - it will update the offset with the status of the LED/lvar when the lvar changes. Those offsets should certainly work - I will double check them next week, but if having issues try debugging the lua script using the facilities provided (i.e. Debug/Trace Lua plugins in the Logging tab). This will tell you if the script is running and what it is doing. Also try logging the offset you are using on the right hand side of the logging tab, and make sure to check Normal log file.
John Dowson Posted August 13 Report Posted August 13 On 7/14/2024 at 12:24 PM, John Dowson said: Those offsets should certainly work - I will double check them next week, @MD80PROJECT Sorry for the delay. I have tested all those offsets and they are certainly available for general use, so you must either be already using those offsets or have something else wrong. As I said, logging should help. Here is the lua script I am testing with (also attached below): local offset = 0x6700 local lvar = "L:YokeLeftVis" local loggingActive = false -- change to true for additional logging messages local lvarValue local offsetValue -- event function to update offset when lvar is updated function lvarUpdated(lvarName, value) lvarValue = value if offsetValue ~= lvarValue then if loggingActive then ipc.log("lvarUpdated: Updating offset with lvar value " .. lvarValue) end ipc.writeUB( offset , lvarValue) elseif loggingActive then ipc.log("lvarUpdated: Not updating offset as already has correct value") end end -- event function to update lvar when offset updated -- NB: to assign to update the offset, use the control: -- Offset Byte Togglebits -- using the offset used and a parameter of x1 function offsetUpdated(offset, value) offsetValue = value if offsetValue ~= lvarValue then if loggingActive then ipc.log("offsetUpdated: Updating lvar with offset value " .. value) end ipc.writeLvar(lvar , value) elseif loggingActive then ipc.log("offsetUpdated: Not updating lvar as already has correct value") end end event.Lvar(lvar, 100, "lvarUpdated") event.offset(offset, "UB", "offsetUpdated") ipc.log ("lvar2Offset script running using lvar '" .. lvar .. "' and offset " .. offset) This script allows the offset to be updated to set the lvar, and any changes to the lvar will update the offset. Note that I am only using a byte to hold the lvar value - this is all that is needed for lvars that have values 1/0. John lvar2Offset.lua
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now