Marcel_Felde Posted April 27, 2009 Report Posted April 27, 2009 Hello there, I am looking for a solution on using Gauges from Flight Illusion with L:Vars. In the software of FI, offsets from FSUIPC can be used to move the needles, and I read that there are user defined Offsets in FSUIPC available. Is there a way to read L:Vars and write them into those offsets? Another question: I created a Macro for a L:Var and wanted to asign an axis to it. The axis works, and if I asign "1=L:AXIS_THROTTLE=SET,2" to the variable, the value is correctly displayed in the variable. But if I use only "1=L:AXIS_THROTTLE=SET", the axis doesn't influence the variable. Any idea what the problem could be? Thanks a lot and greetings, Marcel
Pete Dowson Posted April 27, 2009 Report Posted April 27, 2009 Is there a way to read L:Vars and write them into those offsets? Yes, you would need to use a little Lua plug-in to do it. The supplied Lua library functions can read and write Lvars and offsets both with ease. Another question: I created a Macro for a L:Var and wanted to asign an axis to it. The axis works, and if I asign "1=L:AXIS_THROTTLE=SET,2" to the variable, the value is correctly displayed in the variable. But if I use only "1=L:AXIS_THROTTLE=SET", the axis doesn't influence the variable. Any idea what the problem could be? Hmm. I don't really understand. Is this L:Var "AXIS_THROTTLE" a genuine Lvar in a gauge of your own, or one you've found? I'd need to try it I think. In the first example, which value is "displayed" in the variable (and how are you viewing it?). 2? Regards Pete
Marcel_Felde Posted April 27, 2009 Author Report Posted April 27, 2009 Thanks for the fast answer! :-) Do the lua scripts have to be started in a FS session or do they run automatically? L:AXIS_THROTTLE is a variable I want to use to get the position of the hardware lever which will be modified and saved into the FS Throttle setting. The value of both variables are displayed in a gauge. So it is a variable of my own. 1=L:AXIS_THROTTLE=SET,2 results in a display of "00002" in my gauge. 1=L:AXIS_THROTTLE=SET results in the display of "00000" also I am moving the axis. The axis works fine as I can see during asignment in FSUIPC.
Pete Dowson Posted April 27, 2009 Report Posted April 27, 2009 Do the lua scripts have to be started in a FS session or do they run automatically? As documented, there are two Lua filenames which are automatically run -- ipcinit.lua and ipcready.lua. the 'init' one starts as soon as FSUIPC is initialised (usually a bit before FS is ready) and the 'ready' one starts when FS is ready to fly. You can either put the code into one of thoser, or simply use them to run any other Lua files you want running. L:AXIS_THROTTLE is a variable I want to use to get the position of the hardware lever which will be modified and saved into the FS Throttle setting. The value of both variables are displayed in a gauge. So it is a variable of my own. Your own gauge? So I cannot try it here? Seems a rather, er, odd thing to do. Is there a good reason for it? 1=L:AXIS_THROTTLE=SET,2 results in a display of "00002" in my gauge.1=L:AXIS_THROTTLE=SET results in the display of "00000" Hmmm. It should get the axis value, but this did fall out as a side effect of the way things were programmed -- as I describe in the documentation for the Macros. I'll have to work out a way of testing here. Do you know of any gauges with L:vars taking 16 bit integers which would be visible in some way? [LATER] I've checked the code. The way the parameter is passed is the same for any type of Macro, not just L:Var ones, and I'm sure they work -- or at least, they always did. The code is almost identical. I'm definitely going to need some way of reproducing what you are doing in order to delve further. Regards Pete
Marcel_Felde Posted April 28, 2009 Author Report Posted April 28, 2009 At the moment the gauge does not more than displaying the values. It makes sense for some axis to not directly be used on the systems. For example, the mixture lever in the full forward position means that the ratio is set manually. So if the local variable of the lever has a value of greater than 90, leaning is done manually. If it is pulled back it is used as normal. The propeller setting doesn't work before the oil has a certain temperature so this lever will also not be used "directly" and the throttle will simulate loss of power caused by engine wear. The throttle was only a test to see if I get things working: To control L:Vars by the hardware. I could send you a gauge for testing. I read through the documentation of Lua and some examples here in the forum, but didn't get it yet. But keep on trying. :wink:
Pete Dowson Posted April 28, 2009 Report Posted April 28, 2009 It makes sense for some axis to not directly be used on the systems. For example, the mixture lever in the full forward position means that the ratio is set manually. So if the local variable of the lever has a value of greater than 90, leaning is done manually. If it is pulled back it is used as normal. Yes, I understand that. This is similar to Fly-by-wire, which is used by Airbuses. With FSUIPC you can do that by disconnecting the axis via offset 310A, reading the input values in the relevant copy offset, and finally writing to the relevant axis offset. This is how many Airbus implementations did it in FS9 and before. with FSX of course Simconnect can be used in a similar way. You could also do the same thing using Lua plug-ins. The advantage of both of those two methods is that they are FS9 and FSX compatible. The L:Var facilities in FSUIPC only apply to FSX/ESP. I have to plans to backtrack them to FS9. The L:Var method you are trying should work, however. I will have to find out why it doesn't. I could send you a gauge for testing. That might be useful. I'll have another look at the code first though. I read through the documentation of Lua and some examples here in the forum, but didn't get it yet. Examples are provided with FSUIPC. Ones you can look at and try for yourself. Why not ask questions if there's something you don't understand? I cannot undertake to give a tutorial, but I can answer specific questions. Regards Pete
Pete Dowson Posted April 28, 2009 Report Posted April 28, 2009 I'll have another look at the code first though. Found the problem! I was looking at the implementation of the decoded line from the Macro file, not at the creation of the decoded details. When there's no parameter I should have been setting a flag to say so, and wasn't -- only in the case of L:vars! Please try version 4.515, from this link: http://fsuipc.simflight.com/beta/FSUIPC4515.zip Let me know. I'll only need your gauge if it still doesn't work. Regards Pete
Marcel_Felde Posted April 28, 2009 Author Report Posted April 28, 2009 Great, great! It works now perfectly. Thank you very much! :D I prefer to use L:Vars because the systems are all based on this type of variables and I need the "mixture trick" also for some other features. ;-) Yes, I am also looking at the examples provided with FSUIPC. What I am trying just now is to save my local variables (for example the fuel quantity for both tanks) in those user defined offsets to assign them to the hardware gauges. There is a circuit breaker in the cockpit which has effect on the power supply of some gauges, so if this one is switched off, the fuel quantity pointers drop below zero. So I can't use the FS Offset for the quantity here but have to switch an L:Var via the circuit breaker which influences the L:Vars to be shown by the needles. I just run into trouble linking a Garmin 196 with FSX, can I put my question in this thread or is it better to open a new one?
Pete Dowson Posted April 28, 2009 Report Posted April 28, 2009 Great, great! It works now perfectly. Thank you very much! :D Good. It was a silly error -- glad you tried it. I wouldn't even have thought of testing such an arrangement! ;-) I just run into trouble linking a Garmin 196 with FSX, can I put my question in this thread or is it better to open a new one? Best open a new one with an appropriate title in case someone else has the answer. I assume you checked the documentation, as brief as it is, and searched the threads? I think the x96 series are all similar in this area -- though I've never even seen one myself. Regards Pete
Marcel_Felde Posted April 28, 2009 Author Report Posted April 28, 2009 I am glad if I could be of some help. Got the problem solved meanwhile. Was a problem with the driver of the USB2Serial Cable delivered with the hardware. I downloaded the driver for an older cable, and now the 196 works fine. ;-)
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