michel78320 Posted May 21, 2021 Report Posted May 21, 2021 Hi, First of all, a big thank you for this version 7.1 of FSUIPC. It's great to find again the LVARs and other FSUIPC facilities I just finished the Opencockpit CDU interface with Lvars and Hvars. Everything is functional : CDU ==> USB ==> Sioc ==> FSUIPC (Lua)==> MSFS. Now I am working on the CP-Flight FCU interface : FCU ==> USB (serial) ==> FSUIPC (Lua)==> MSFS. I have some problems reading the variable "ALT" : Offset 0x0818 = 32bits ? Offset monitor : Monitor IPC:818 (U32) = 673170048 SimRead 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 10271.7597656 The value is correct for alt = 10 271 m (33 700 feet) BUT when I read it, with" ipc.readFLT ( 0x0818)", I get strange values : 8.8684485102797e-15 How to get the right value with ipc.read ? I tried ipc.readUB, ipc.readUW, ipc.readUD. Nothing works.
John Dowson Posted May 21, 2021 Report Posted May 21, 2021 4 minutes ago, michel78320 said: Monitor IPC:818 (U32) = 673170048 You should monitor as a FLT32, not U32. 6 minutes ago, michel78320 said: BUT when I read it, with" ipc.readFLT ( 0x0818)", I get strange values : 8.8684485102797e-15 How to get the right value with ipc.read ? I tried ipc.readUB, ipc.readUW, ipc.readUD. Nothing works. ipc.readFLT is correct. I don't know why you are getting that value, it does seem strange. I will take a look (probably tomorrow now though), but would be useful if you could attach your FSUIPC7.log file showing the issue, together with your FSUIPC7.ini file and your lua script. You should maybe also try the latest FSUIPC7 beta, available here: John
michel78320 Posted May 21, 2021 Author Report Posted May 21, 2021 Thank you for the quick reply. I redid a test with the minimum: a single lua reduced to the minimum. First, I noticed that I have to do CTRL-2 several times. As the log shows, the script starts well but does not proceed till ipc.log !!! Attached my last tests. "You should monitor as a FLT32, not U32." ==> I always get zero !!! 18047 Monitor IPC:0818 (FLT32) = 0.00000000 62422 Monitor IPC:0818 (U32) = 733096192 66500 Monitor IPC:0818 (U32) = 735093696 66500 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11216.6396484 68343 Monitor IPC:0818 (U32) = 733096192 68343 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11186.1601562 69343 Monitor IPC:0818 (U32) = 731098624 69343 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11155.6796875 83906 Monitor IPC:0818 (FLT32) = 0.00000000 I tried version 7.2 yesterday : but when I ask for the list of LVARs or HVARs, I get 0 values ! So I came back to version 7.1. aaaa.lua FSUIPC7.ini FSUIPC7.log
John Dowson Posted May 21, 2021 Report Posted May 21, 2021 I'll take a look in detail tomorrow, but why are you reading the offset? Your function and event call are wrong: Quote function A320_ALT_show () Q_alt = ipc.readFLT( 0x0818 ) ipc.log ("================== Q_alt = " .. Q_alt) end event.offset (0x0818, "UD", "A320_ALT_show") Try with: Quote function A320_ALT_show (offset, value) ipc.log ("================== value= " .. value) Q_alt = ipc.readFLT( 0x0818 ) ipc.log ("================== Q_alt = " .. Q_alt) end event.offset (0x0818, "FLT", "A320_ALT_show") 1 hour ago, michel78320 said: I tried version 7.2 yesterday : but when I ask for the list of LVARs or HVARs, I get 0 values ! Well, that shouldn't happen! You should try again and if you get issues report them. Best to set logging for the WAPI and WASM to Debug and attach your FSUIPC7.log and FSUIPC_WASM.log files of/when reporting issues. 1 hour ago, michel78320 said: You should monitor as a FLT32, not U32." ==> I always get zero !!! 18047 Monitor IPC:0818 (FLT32) = 0.00000000 62422 Monitor IPC:0818 (U32) = 733096192 66500 Monitor IPC:0818 (U32) = 735093696 66500 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11216.6396484 68343 Monitor IPC:0818 (U32) = 733096192 68343 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11186.1601562 69343 Monitor IPC:0818 (U32) = 731098624 69343 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 11155.6796875 83906 Monitor IPC:0818 (FLT32) = 0.00000000 Where is this from? Its not in the log you attached. Maybe try monitoring 0x0818 as both a U32 and a FLT32. It would be helpful if I can see that in the full log, together with your updated ini. 1 hour ago, michel78320 said: First, I noticed that I have to do CTRL-2 several times. . As the log shows, the script starts well but does not proceed till ipc.log !!! That really shouldn't be necessary. Your log shows the script start ok the first time: Quote 15375 -------------------- Starting everything now ---------------------- 15375 Starting WideServer now ... 34578 LUA.1: beginning "C:\FSUIPC7\aaaa.lua" 34578 LUA.1: C:\FSUIPC7\aaaa.lua:1 34593 LUA.1: Global: ipcPARAM = 0 34609 LUA.1: ================== Lancement Lua Anyway, there has been a couple of changes in management oif lua events in 7.2, so please download and try that and report back first, and I'll take a look in more detail over the weekend.
John Dowson Posted May 21, 2021 Report Posted May 21, 2021 43 minutes ago, John Dowson said: 18047 Monitor IPC:0818 (FLT32) = 0.00000000 62422 Monitor IPC:0818 (U32) = 733096192 66500 Monitor IPC:0818 (U32) = 735093696 66500 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" The 0.0000 value at 18047 us also VERY early (18 seconds after starting), thats probably the empty value before it received any data. However, I don't understand why its logging later as U32 and no later log as FLT32. This is the problem when you paste extracts - they are difficult to understand. Please do as advised, log as both U32 and FLT32, and then show me your full log and update ini files.
michel78320 Posted May 21, 2021 Author Report Posted May 21, 2021 OK. I will try (again) 7.2 (after a new download) and report back (tomorrow). Many thanks for your answers.
michel78320 Posted May 22, 2021 Author Report Posted May 22, 2021 Hi, here I am again. Here is what I did: - Erase log files+ uninstall FSUIPC - Download FSUIPC7.2a - Install FSUIPC 7.2a - Run MSFS (updated 1.15.10.0) - Load Cessna 172 - Fly 2 mn - Run FSUIPC (see log file) - Run aaaa.lua using Ctrl+4 - Inc altitude with my Saitek panel (three times). - Close FSUIPC It seems that the "value" parameter is not read in the correct format (FLT). No more with a "ipc.read" instruction. But with the offset log, it's good. Please find attached all the files. Thank you in advance. aaaa.lua FSUIPC7.ini FSUIPC7.log
Pete Dowson Posted May 22, 2021 Report Posted May 22, 2021 2 hours ago, michel78320 said: It seems that the "value" parameter is not read in the correct format (FLT). No more with a "ipc.read" instruction. But with the offset log, it's good. The value in 0818 is the altitude lock value * 65536. Look 59906 Monitor IPC:0818 (U32) = 125844848 59906 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 1920.23999023 Now see: 125844848 / 65536 = 1920.2399 The offset is in the same format as most of the other Autopilot values. It is NOT a FLT32. That's only how SimConnect supplies it. Like most FSUIPC offsets it is converted for compatibility with past versions of FS (dating back as far as FS98). With event.offset there's no need to do any ipc.read in any case. The value is supplied as one of the two parameters. Pete
michel78320 Posted May 22, 2021 Author Report Posted May 22, 2021 18 minutes ago, Pete Dowson said: Now see: 125844848 / 65536 = 1920.2399 The offset is in the same format as most of the other Autopilot values. It is NOT a FLT32. That's only how SimConnect supplies it. Like most FSUIPC offsets it is converted for compatibility with past versions of FS (dating back as far as FS98). OK. I understand all that. 1 hour ago, Pete Dowson said: With event.offset there's no need to do any ipc.read in any case. The value is supplied as one of the two parameters. My lua script is just an example. But I need to read this value in other routines, not called by event.offset. Luckily, it seems that FSUIPC7.2a is reporting a good value with ipc.readSD (0x0818) while FSUIPC7.1 did not. Of course, the value I get is in meters, and I convert it to feet before I send it to my FCU. Now, I have everything I need to continue my programming. Thank you very much for your explanations and your help.
John Dowson Posted May 22, 2021 Report Posted May 22, 2021 3 hours ago, Pete Dowson said: The value in 0818 is the altitude lock value * 65536. Look 59906 Monitor IPC:0818 (U32) = 125844848 59906 SimRead: 0818="AUTOPILOT ALTITUDE LOCK VAR:3" FLT32: 1920.23999023 Now see: 125844848 / 65536 = 1920.2399 Sorry, that was my fault misleading you without checking...its also not clear from the documentation/spreadsheet. I will update to clarify.
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