Detlef_747 Posted September 1, 2022 Report Posted September 1, 2022 Hello, I updated to FSUIPC7 7.3.8 yesterday, because I saw the offset list for the PMDG 737. But somehow I couldn't get Lvars working correctly. I am familiar with Lua and am using it for Sim Innovations Air Manager instruments. I wanted to create my own Lvars with an FSUIPC Lua script. If I create the Lvar using ipc.createLvar(name, 1234) giving an initial value of 1234 that Lvar shows up as expected. But I cannot write to it using ipc.writeLvar(name, ipc.readUB(offset). I have added this section to 737options.ini in C:\Users\dreu\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\pmdg-aircraft-737\work [SDK] EnableDataBroadcast=1 EnableCDUBroadcast.0=1 EnableCDUBroadcast.1=1 (and restart of everything) with no better results. I then saw that I could write Lvars directly into the fsuip7.ini file. I tried this: [LvarOffsets] 1=L:IPCPMDG_MAIN_annunAP=UB0x65F1 2=L:IPCPMDG_MAIN_annunAP_Amber=UB0x65F3 3=L:IPCPMDG_MAIN_annunAT=UB0x65F5 4=L:IPCPMDG_MAIN_annunAT_Amber=UB0x65F7 5=L:IPCPMDG_MAIN_annunFMC=UB0x65F9 6=L:IPCPMDG_FUEL_PumpFwdSw=UB0x6479 resulting in entries in the log file, saying the variable cannot be assigned because it does not exist. That remains so after clicking WASM reload in the menu. So I tried in a Lua script to only generate an Lvar if it does not already exist, but ipc.getLvarId(name) always returns not nil (meaning the Lvar already exists?) I then tried with the default Cirrus aircraft and got no better results. I see that I can read from offsets but I cannot write them to Lvars. I have tried all I can think of, so I would appreciate your help. I attach my latest log file here. That one was with the cirrus. Thank you Detlef FSUIPC7.log
John Dowson Posted September 1, 2022 Report Posted September 1, 2022 I am slightly confused by your post. The PMDG offsets are not lvars, it is additional read-only data provided by PMDG. 48 minutes ago, Detlef_747 said: If I create the Lvar using ipc.createLvar(name, 1234) giving an initial value of 1234 that Lvar shows up as expected. But I cannot write to it using ipc.writeLvar(name, ipc.readUB(offset). What happens> Show me the lua scrip, and activate logging for lua plugins and see if you get any errors. Note that if creating youy own lvars, it may take a short time before that lvar is available for reading/writing. 51 minutes ago, Detlef_747 said: I have added this section to 737options.ini in C:\Users\dreu\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\pmdg-aircraft-737\work [SDK] EnableDataBroadcast=1 EnableCDUBroadcast.0=1 EnableCDUBroadcast.1=1 That enables the broadcasting of the data to enable the FSUIPC PMDG offsets (read-only) to be populated. 52 minutes ago, Detlef_747 said: then saw that I could write Lvars directly into the fsuip7.ini file. I tried this: [LvarOffsets] 1=L:IPCPMDG_MAIN_annunAP=UB0x65F1 2=L:IPCPMDG_MAIN_annunAP_Amber=UB0x65F3 3=L:IPCPMDG_MAIN_annunAT=UB0x65F5 4=L:IPCPMDG_MAIN_annunAT_Amber=UB0x65F7 5=L:IPCPMDG_MAIN_annunFMC=UB0x65F9 6=L:IPCPMDG_FUEL_PumpFwdSw=UB0x6479 Do those lvars exist, or are you creating them? You cannot add lvars that you create using the [LvarOffsets] section as this is only processed when the initial lvars are received from the WASM. If they exist when you list them but are not available for adding to offsets, this implies that they had not been created when the WASM scanned for existing lvars. This happens with complex aircraft as it can take up to a minute or so to create all the necessary lvars. You should update the LvarScanDelay FSUIPC_WASM.ini parameter - this defaults to 5 (seconds) but is recommend to start with a value of 45 or so (see the Advanced User guide for details). Any further issues, please show me your FSUIPC7.ini as well as the FSUIPC7.log file, and any lua scripts if the problem is there. John
Detlef_747 Posted September 1, 2022 Author Report Posted September 1, 2022 John, thank you for your fast reply. 6 hours ago, John Dowson said: I am slightly confused by your post. The PMDG offsets are not lvars, it is additional read-only data provided by PMDG. I am sorry if I sound confusing. My intention is to read contents from offsets and write that contents into Lvars that I create myself using Lua script in FSUIPC. 6 hours ago, John Dowson said: What happens> Show me the lua scrip, and activate logging for lua plugins and see if you get any errors. Note that if creating youy own lvars, it may take a short time before that lvar is available for reading/writing. I did that here. See the attachment. I modified my lua script to be as simple as possible and inserted a 5 second pause before trying to write to the Lvar. My problem here: I always read 0 as value. I actually see the Lvars I created in my Airmanager instrument with their initial values 1234.0 and 4321.0 respectively. But after 5 s the display switches to 0. I have attached the files here. So I seem to never get any data from the offsets. 6 hours ago, John Dowson said: Do those lvars exist, or are you creating them? You cannot add lvars that you create using the [LvarOffsets] section as this is only processed when the initial lvars are received from the WASM. I am sorry if I was confusing here. I did not try both at the same time. So when trying the .ini section I did not use a Lua script to generate Lvars. So in the files attached I had the PMDG 737-700 running, with engines off, APU on. I tried these specific offsets because I know how I can use PMDGs original Lvars for that. So I know they should work (0x64bb and 0x64E8). Thank you Detlef pmdg737.log FSUIPC7.ini FSUIPC7.log
John Dowson Posted September 1, 2022 Report Posted September 1, 2022 12 minutes ago, Detlef_747 said: So when trying the .ini section I did not use a Lua script to generate Lvars. Ok. But if you don't create the lvars, they won't exist and they will be ignored. But I need to see your pmdg737.lua script - you forgot to attach that... John
Detlef_747 Posted September 1, 2022 Author Report Posted September 1, 2022 55 minutes ago, John Dowson said: But I need to see your pmdg737.lua script - you forgot to attach that... Sorry, this is the script pmdg737.lua
John Dowson Posted September 1, 2022 Report Posted September 1, 2022 Try with: ipc.createLvar("ipcpmdg_ELEC_annunAPU_GEN_OFF_BUS", 1234) ipc.createLvar("ipcpmdg_APU_EGTNeedle", 4321) ipc.reloadWASM() ipc.sleep(1000) ... i.e. you need to reload thee lvars from the WASM a before they become available. Note also that if a reload results in more lvars being found than previously (which of course there will be as you have created some), then this will/should trigger the reload of the [LvarOffsets] section from the ini. John
John Dowson Posted September 1, 2022 Report Posted September 1, 2022 But the problem looks to be that the offset value isn't changing, no? Presuming that is the correct offset (I have only spot-checked some and calculated the rest from an SDK file) and if so then the data isn't being provided correctly. As the SDK for the PMDG 737 for MSFS has still not been published, there is not much that can be done at the moment. I will take a look at this to verify (tomorrow now) and will start to maintain a list of of valid/invalid offsets for the PMDG 737 - should have done this at release! John
Detlef_747 Posted September 1, 2022 Author Report Posted September 1, 2022 45 minutes ago, John Dowson said: Try with: ipc.createLvar("ipcpmdg_ELEC_annunAPU_GEN_OFF_BUS", 1234) ipc.createLvar("ipcpmdg_APU_EGTNeedle", 4321) ipc.reloadWASM() ipc.sleep(1000) ... i.e. you need to reload thee lvars from the WASM a before they become available. Note also that if a reload results in more lvars being found than previously (which of course there will be as you have created some), then this will/should trigger the reload of the [LvarOffsets] section from the ini. John I just did. The Lua program stops running then I think. I am not sure I should restart everything. I will try more tomorrow. And I will try again with offsets for a default aircraft. Thank you Detlef pmdg737.log pmdg737.lua
Detlef_747 Posted September 2, 2022 Author Report Posted September 2, 2022 14 hours ago, John Dowson said: But the problem looks to be that the offset value isn't changing, no? Presuming that is the correct offset (I have only spot-checked some and calculated the rest from an SDK file) and if so then the data isn't being provided correctly. As the SDK for the PMDG 737 for MSFS has still not been published, there is not much that can be done at the moment. I will take a look at this to verify (tomorrow now) and will start to maintain a list of of valid/invalid offsets for the PMDG 737 - should have done this at release! Hi John, I experimented some more this morning. With the Cirrus aircraft (FS2020 default) everything works as expected. I can read from offset 0x0bfc (flaps index) and write that value into an Lvar that I create myself (L:my_flaps_index). I can see and work with that Lvar in Air Manager (which is my goal). The Lvar also shows up in the Lvar list, if I generate one with the FSUIPC menu call. I have attached the resulting files here. However, if I try with PMDG offsets, I always see 0 as value. (Maybe some do work, that I did not try.) Can I somehow verify that the PMDG 737 is broadcasting its data? (I have the SDK section in the 737options.ini file but maybe something else is missing in my settings). Thank you Detlef pmdg737.lua FSUIPC7.ini FSUIPC7.log pmdg737.log
John Dowson Posted September 2, 2022 Report Posted September 2, 2022 1 hour ago, Detlef_747 said: ;However, if I try with PMDG offsets, I always see 0 as value. (Maybe some do work, that I did not try.) Can I somehow verify that the PMDG 737 is broadcasting its data? (I have the SDK section in the 737options.ini file but maybe something else is missing in my settings). It could be that those offsets are not populated. I am going to put together a list of working/not working offsets so that these can be reported to PMDG once the SDK has been released. You could check the following offsets which are the most recent ones i have checked as working; Quote 65EA 1 BYTE MAIN_NoseWheelSteeringSwNORM Boolean, false: ALT Quote 65FD 1 BYTE MAIN_annunSPEEDBRAKE_ARMED Boolean Otherwise, you can add the following to the [General] section of your FSUIPC7.ini which will log the reception of PMDG client data: TestOptions=x400 John
Detlef_747 Posted September 2, 2022 Author Report Posted September 2, 2022 1 hour ago, John Dowson said: You could check the following offsets which are the most recent ones i have checked as working Unfortunately I am also reading 0 all the time from those two offsets you mentioned. And I operated "arm spoiler" and the nose wheel steering switch. ipc.readUB(0x65ea) ipc.readUB(0x65fd) 1 hour ago, John Dowson said: Otherwise, you can add the following to the [General] section of your FSUIPC7.ini which will log the reception of PMDG client data: TestOptions=x400 I did that. The log file says: 267687 PMDG 737 Client Data Received: ID=1313289013, Size=1049, FirstDataDW=536870944 (FSUIPC7 logfile attached) It says that just once, not repetatively. I may still be missing something. Thank you Detlef FSUIPC7.log pmdg737.lua
John Dowson Posted September 3, 2022 Report Posted September 3, 2022 On 9/2/2022 at 3:13 PM, Detlef_747 said: I did that. The log file says: 267687 PMDG 737 Client Data Received: ID=1313289013, Size=1049, FirstDataDW=536870944 (FSUIPC7 logfile attached) It says that just once, not repetatively. This is correct - it only logs the first reception of data, and not subsequent ones. To log every reception (and a lot more), you can use the Log->Custom option and enter x4000 - this will log everything received via SimConnect. Can you please try logging offset 0x65EA using FSUIPC's offset monitoring facilities, then remove the nose wheel switch guard and toggle the nose wheel steering switch a few times and see if the offset changes. Not sure what is happening with your lua...there are only these statements in your log: Quote 451297 LUA: "C:\FORMSFS2020\FSUIPC7\pmdg737.lua": killed 675750 LUA: "C:\FORMSFS2020\FSUIPC7\pmdg737.lua": killed 822797 LUA: "C:\FORMSFS2020\FSUIPC7\pmdg737.lua": killed 4550937 LUA: "C:\FORMSFS2020\FSUIPC7\pmdg737.lua": killed Did you not set logging for Lua plugins? If not, please do that, and log to the standard log file (i.e. do not Log Lua Separately). But lets first see if you are getting the PMDG offset data correctly first before we sort out why the lua isn't working correctly. Better (but not strictly necessary) also to use ipc.log rather than print in your lua scripts. John
John Dowson Posted September 3, 2022 Report Posted September 3, 2022 There does look to be a timing issue when calling reloadWASM directly after creating the lvars - I will look into this. Changing the script to Quote ipc.createLvar("ipcpmdg_MAIN_NoseWheelSteeringSwNORM", 5400) ipc.createLvar("ipcpmdg_MAIN_annunSPEEDBRAKE_ARMED", 2300) ipc.sleep(1000) ipc.log("Reloading WASM...") ipc.reloadWASM() ipc.log("Reloading WASM done") ipc.sleep(5000) ... produces the output in the attached log when toggling the nose wheel steering switch...i.e. as expected... John FSUIPC7.log
John Dowson Posted September 3, 2022 Report Posted September 3, 2022 The WASM reload isn't necessary - and can cause FSUIPC to crash - I will look into this). The WASM forces a new lvar scan when a new lvar is created, and there looks to be a timing or thread issue somewhere - and can also crash without the reload. Changing the lua to the following: ipc.createLvar("ipcpmdg_MAIN_NoseWheelSteeringSwNORM", 5400) ipc.sleep(1000) ipc.createLvar("ipcpmdg_MAIN_annunSPEEDBRAKE_ARMED", 2300) ipc.sleep(1000) ipc.log("Startng loop...") local v while true do v = ipc.readUB(0x65ea) print("nose wheel steering Switch "..v) ipc.writeLvar("ipcpmdg_MAIN_NoseWheelSteeringSwNORM", v) v = ipc.readUB(0x65fd) print("annunc speedbrake armed "..v) ipc.writeLvar("ipcpmdg_MAIN_annunSPEEDBRAKE_ARMED", v) ipc.sleep(1000) end seems to be stable, produces the attached log. Note that new config data (lvar and hvar names) is received when a new lvar is created. The rest of the log just shows the nose wheel steering Switch being toggled a few time, logged by FSUIPC monitoring as well as the lua script logging. I will investigate the FSUIPC crash. On your side, you should set Debug level logging in the WAPI, forget about the lua script for the time being, monitor offset 65EA and see if that changes when you toggle the nose wheel steering switch (after removing the guard). I would like to confirm or otherwise if you are receiving the PMDG client data regularly - we need to sort that out first. John FSUIPC7.log
Detlef_747 Posted September 4, 2022 Author Report Posted September 4, 2022 21 hours ago, John Dowson said: Did you not set logging for Lua plugins? If not, please do that, and log to the standard log file (i.e. do not Log Lua Separately). John, thank you for the ongoing support. Sorry I deactivated the Lua logging at some point. I have it on again now. 21 hours ago, John Dowson said: This is correct - it only logs the first reception of data, and not subsequent ones. To log every reception (and a lot more), you can use the Log->Custom option and enter x4000 - this will log everything received via SimConnect. Can you please try logging offset 0x65EA using FSUIPC's offset monitoring facilities, then remove the nose wheel switch guard and toggle the nose wheel steering switch a few times and see if the offset changes. Both is on now. I also activated the option to see offset 65EA in the windows title. It always says 0. I have activated event logging also. Usually I would send event 32503 to operate the nose wheel steering switch. If I look at the log file, that event is present, but still offset 65EA is not changing in my environment here. Thank you for sending your log file. Yes, I see it is working in your setup. Something must be wrong or different in my setup. I have not yet tried with a modified lua script. But that seems not to be the main issue. Thank you Detlef FSUIPC7.log FSUIPC7.ini
John Dowson Posted September 4, 2022 Report Posted September 4, 2022 I have found the issue that can cause FSUIPC to crash when creating lvars and/or reloading the WASM in succession. This will be fixed in the next release, but for the time being please add an ipc.sleep call after creating an lvar. As to your issue with the PMDG data not being received, I don't know what can be causing this., it is very strange. Maybe try uninstalling the PMDG 737 completely, then re-install and check broadcasting enabled and try again. John
John Dowson Posted September 4, 2022 Report Posted September 4, 2022 2 hours ago, Detlef_747 said: Usually I would send event 32503 to operate the nose wheel steering switch. If I look at the log file, that event is present, but still offset 65EA is not changing in my environment here. Did/can you try flipping the switch in the cockpit UI (after removing the guard) - I am not sure if sending the event will work without removing the guard first..
Detlef_747 Posted September 4, 2022 Author Report Posted September 4, 2022 5 hours ago, John Dowson said: As to your issue with the PMDG data not being received, I don't know what can be causing this., it is very strange. Maybe try uninstalling the PMDG 737 completely, then re-install and check broadcasting enabled and try again. Installing the latest version sometimes does miricles.. I updated the aircraft to the latest PMDG 737 version, and the offsets mentioned above do work now! 5 hours ago, John Dowson said: I have found the issue that can cause FSUIPC to crash when creating lvars and/or reloading the WASM in succession. This will be fixed in the next release, but for the time being please add an ipc.sleep call after creating an lvar. The lvars creation also works. I will leave the ipc.sleep calls inserted until the next FSUIPC7 version. I will try with a list of offsets, which will sum up the wating time, but that really is not a problem right now. Thanks again for your help. I very much appreciate it. The issue is solved. Detlef
John Dowson Posted September 4, 2022 Report Posted September 4, 2022 You can try the attached version - this is the same as the released version but with the lvar creation issue hopefully fixed...please report any issues. John FSUIPC7.exe
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