Jump to content
Sign in to follow this  
JimboG

Flight1 Cessna Mustang - New Profile Request

Recommended Posts

Hello there, Having been introduced to Linda through getting my VRInsight MCP Combo to work with the PMDG 737 NGX and having a wonderful time with it I would very much like to explore the possibility of using this combination of tools with my Flight1 Cessna Mustang. The Mustang has been sat in it's hangar for two years as I simply did not have a machine quick enought to run it properly. I am using an interim-machine currently in preparation for building my dream rig which has in itself been in the pipeline for three years and at the moment I am having a great time with my little Cessna as a nice distraction from the PMDG. I've installed FSUIPC 4.742 and Linda 1.02 from http://fs-linda.com/ and now I am wondering if anyone has either attempted to create a new profile for another add-on or if they might have some pointers for me. I don't expect any miracles or someone to create a profile for me but I suppose I'd like to know if it's possible for a profile to be created by a person without masses of development experience? Would anybody like to comment on this? Are there any critical pre-reqs I should know about that might be show-stoppers before I look into this? If it helps, I believe that Flight1 released a vsersion of the Cessna Mustang which apparently allows for Keyboard Assignments to be added to a file Input.ini somewhere - I am hoping that this might be a starting place? In other words, although possibly a bit primative fundementally this could be made to work? (I have the latest version installed) In terms of functionality I am not looking for too much, it's mainly for the Autopilot panel and maybe a few other switches I'd be looking to control. Many thanks for any advice, tips, pointers, gotchas or KB articles you might have. Kind regards, James Gillies

Share this post


Link to post
Share on other sites

Hello James, I have gathered a lot of LUA variables for the Mustang in the Pre LINDA times (very sad times ;-) ) I havent installed the Cessna since a couple of years also.But if you are interested, I can give you th script - it should be not too tricky to make a module for LINDA out of it.Unfortunately I do not have the time (and interest to be honest) to make a Mustang profile currently ...


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hello Guenter, Thanks very much! I would like to take a look at your script to see if I can pick up where you left off. I have just spend a couple of hours playing with Linda and getting to know what some of the buttons do with the tracing and seeing what the Mustang interface thorws out to it. A lot of functions are mimicked from the default FSX controls by the look sof it - but it'snot comprehensive and there are certainly some custom controls in there. Thanks again for your quick response. I will treat this as a pet project. Kind regards, James Gillies

Share this post


Link to post
Share on other sites

Oh, sorry... my mind told me something wrong....I haven't gathered a lot, only a few here are the LVArs

-- 1 = BATT toggle-- 2 = both Generators toggle-- 3 = Avionics-- 4 = Taxi Lights ON-- 5 = Landing Lights ON-- 6 = Taxi and Landing lights OFF-- 7= Panel light toggle-- 8 = toggle starter 1-- 9 = toggle starter 2-- 10 = Master Warn-- BATT toggleif ipcPARAM == 1 then  LVarSet = "L:Masterbatt"val = 0if ipc.readLvar(LVarSet) == 0  thenval = 1endipc.writeLvar(LVarSet, val)ipc.control(66241)ipc.sleep(50)ipc.control(65823, 2) -- knob soundend  -- both generators toggleif ipcPARAM == 2 then  LVarSet = "L:LEFTGEN"LVar2Set = "L:RIGHTGEN"val = 0if ipc.readLvar(LVarSet) == 0  thenval = 1endipc.writeLvar(LVarSet, val)ipc.writeLvar(LVar2Set, val)ipc.control(66364)ipc.sleep(50)ipc.control(65823, 1) -- knob soundipc.control(66363)ipc.sleep(50)ipc.control(65823, 1) -- knob soundend-- Avionics, STb Instruments and Anti Skid toggleif ipcPARAM == 3 then  ipc.control(66293)ipc.sleep(50)ipc.control(65823, 2) -- knob soundLVarSet = "L:ANTISKID"val = 0if ipc.readLvar(LVarSet) == 0  thenval = 1  ipc.control(65823, 329)endipc.writeLvar(LVarSet, val)ipc.sleep(50)ipc.control(65823, 2) -- knob soundLVarSet = "L:STBYAVIONICS"val = 0if ipc.readLvar(LVarSet) == 0  thenval = 1endipc.writeLvar(LVarSet, val)ipc.sleep(50)ipc.control(65823, 2) -- knob soundend-- Taxi Lights ONif ipcPARAM == 4 then ipc.writeLvar("L:LANDRECTAXI", 1)ipc.control(65823, 1) -- knob soundend-- Landing Lights ONif ipcPARAM == 5 then ipc.writeLvar("L:LANDRECTAXI", 2)ipc.control(66059, 1)ipc.control(65823, 1) -- knob soundend-- Taxi and Landing Lights OFFif ipcPARAM == 6 then ipc.writeLvar("L:LANDRECTAXI", 0)ipc.control(66060, 1)ipc.control(65823, 1) -- knob soundend -- Panel light toggleif ipcPARAM == 7 then  LVarSet = "L:panel_lights"LVar1Set = "L:InstLt"LVar2Set = "L:MustangInstrLt"val = 0if ipc.readLvar(LVarSet) == 0  thenval = 1endipc.writeLvar(LVarSet, val)ipc.writeLvar(LVar1Set, val)ipc.writeLvar(LVar2Set, val)ipc.sleep(50)ipc.control(65823, 3) -- knob soundend-- Starter 1 ONif ipcPARAM == 8 then ipc.control(66300)ipc.writeLvar("L:MustangLeftStarter", 1)ipc.writeLvar("L:LEStartTimer", 63401433820.394)ipc.sleep(50)ipc.control(65823, 4) -- knob soundend-- Starter 2 ONif ipcPARAM == 9 then ipc.control(66301)ipc.writeLvar("L:MustangRightStarter", 1)ipc.writeLvar("L:REStartTimer", 63401433820.394)ipc.sleep(50)ipc.control(65823, 4) -- knob soundend-- Master Warnif ipcPARAM == 10 then   ipc.control(65823, 32)end 

and here some macros

[Macros]Module="Flight1_GarminG1000_510.GAU"1=L:G1000DimBright=INC2=L:G1000DimBright=DEC3=APPR=RX926f0*X55904=NAV=RX92830*X55905=ALT press=RX92b50*X55906=VS press=RX92c40*X55907=FLC=RX92d30*X55908=ALT plus=RX93e70*X55909=ALT minus=RX93db0*X559010=SPD=RX933a0*X559011=HDG Knob Press=RX93930*X559012=CRS Knob Press=RX93b70*X559013=HDG hold=RX92610*X5590

it is not difficult to change the LVar script into LINDA; but I think the macros will not work any more as the numbers changed with every update of the mustang


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hi Guenter, Thanks very much for this, it has given me something to start from. I've just spent about 90 minutes reading through the 25 page LINDA manual and very helpful it was too! It took a while but I managed to find the first LVar function that I'd like to assign to a Knob on my MCP Combo. In the Linda Console I can see that the ALT knob spits out: [L] LVar: ApAltSelKnob = 45 The value increases by 5 every time you turn it to the right of the "12 o' clock" position, from 5 to 100 - but if you go in reverse it seems to go back wards from 0 to 99 and then minus 5 each position back to 0 - so 0, 99, 94, 89 etc etc I am not sure if this has any bearing on the values used by the Mustang though because the only distinction is one of four variables: +100 feet-100 feet+1000 feet- 1000 feet This is identified by the position of the mouse and therefore the click-spot. The existing value in the Garmin for the target altitude is then updated according to which of the four commands requested it. The LINDA manual states that "Please have a close look in the FSUIPC documentation about Macros, LUA Variables and offsets! - all is pretty good described there" I take it that I should start looking there to see what my next steps are? The penny is floating in the air at the moment and is almost ready to drop but I realise that there is a missing peice to the puzzle that I need to understand to take what I have found in the LINDA tracer and the wheel on my MCP Combo... I am assuming that I will need to create a LIB: User Function or similar that will look a bit like the samples you sent me above? And if so I will be able to create LUA functions in LINDA against the LVar and be able to create the four scenarios I described for that one knob? If this is true then I would appreciate the slightest of nudges towards the next step so that I may progress this. I don't care if it's just one knob to start with - if I can understand the process from end-to-end then that's one less to do! Go on, give me another clue, I'm four hours in now and am more than curious to understand this more. I am also quite anally-retentive and I don't give up easily! This is just another puzzle to solve. Thanks for your help so far Guenter. Kind regards, James Gillies

Share this post


Link to post
Share on other sites

A quick update on this. I have figured out hot to create Mouse Macros in FSUIPC for the four variables for the ALT knob and have got them assigned nicely in LINDA. I can go fast or slow up and down the Altitude scales. (I know that that this is not difficult but I have never done it before and have only tried this about 30 minutes ago!) What I would ideally like to do is to learn how to get the display for ALT to macth what is showing in the Gauge - in this case the Flight1 Garmin 1000 I realise that using FSUIPC Macros might be more limited than using full-on Lua scripts but one step at a time. I presume that I will be able to do this one way or another as the HDG (for example) is fed back from a Default FSX Control (I believe). The Garmin 1000 gauge on the Mustang is using a custom diaply - but it is there, I just need to understand the process of getting to it programatically, Thanks very much! Kind regards, James Gillies

Share this post


Link to post
Share on other sites

Nice to see that you have the courage to program happy.pngYou will see, it is a nice hobby; a bit like crosswors or sudoku... ^^ for the ApAltSelKnob LVar:seems, only the knob in the VC is controlled (meaning just the 3D model would be turned with this LVar)I can't remember but with a look to my script above, you can see that I also used LVars (for the knobs), but controls to switch the "real thing" So, you need a Lvar to move the Battery switch, and you need a control number to switch the battery system of the aircraft.Seems this system is for any other switches, too... As for the displays: aren't the Mustag gauges and the MCP displays synchronised by itself (same like standard FSX planes)?thats odd as the chance to make them work will decrease. If I understood correct, you want also to know how to start now to make a new module?in LINDA, click beside the aircraft selection on the left at "new" and enter "module name" and "aircraft string".Then you have a new, empty module.Select then the Mustang in LINDA and "edit module" to open the new Mustang script with LINDA editor.(you have to be in developer mode (--> settings --> setup LINDA)) I will this evening install the Mustang and try to hunt a little.Hopefully we can make a good module together ...


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

I installed and checked the Mustang now: bad news: I see absolute no possibiliy to synchronise the VC Autopilot Displays with the MCP.All we can have is the normal Flight Information But I started to make the Mustang module ...Maybe I interupt at a certain point and give it to you to complete it ;-)


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hi Guenter, Wow, you have been busy! As it happens I have been lookinng at this all afternoon (I am on vacation this week!) and I have started to learn about how the modules work, along with the various commands used from other modules. I started to get the beginnings of something but without full understanding of how the variables work and how to write Lvar values back based on additions and subtractions it was very hit and miss! Nothing below this actually works, but you will get the idea of how far I have got.... which as I say was the nucleus of something but not actaully working yet. Not bad for an afternoons work when this time yesterday I knew nothing whatsoever about Lua, mouse macros and so on! -- Flight1 Cessna Mustang - James Gillies October 2011 v0.1 ---- ## System functions ##function InitVars () -- uncomment to disable display -- AutopilotDisplayBlocked ()end-- ## Autopilot Functions ##function VsWheel_Up () LVarSet = "L:VsWheel" ipc.readLvar(LVarSet) ipc.writeLvar(LVarSet, LVarSet + 10) ipc.control(65894)end-- ## Left Switch Panel - code from Guenter ##function Battery_Toggle ()LVarSet = "L:Masterbatt" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1end ipc.writeLvar(LVarSet, val) ipc.control(66241) ipc.sleep(50) ipc.control(65823, 2) -- knob soundend I will be going out for an hour or two shortly, but will be back later. I would be very interested to see what you've come up with so far - it would be good to understand how LINDA/Lua works. As for the displays, fair enough, I can't argue with that! Kind regards, James Gillies

Share this post


Link to post
Share on other sites

Hi Guenter, I am back home now (I've just done the 1st session of an 8 week boxing boot camp and I am destroyed! I can bearly lift my arms!) I wasn't able to go into too much detail earlier on, but basically I've spent the afternoon understanding the layouts of Lua scripts, some of the variable names and how they fit into FSUIPC. I've also done some research into the FSUIPC advanced users guide to see how the ipc.control commands work. I've also read through some other forum threads on this site to get a better understanding of how to hook Lua scripts into FSUIPC, such as this one: http://forum.avsim.n...-apr-in-fsuipc/ And this one: http://forum.avsim.n...or-cdu-buttons/ And this one: http://forum.avsim.n...-one-key-press/ But most of all, this one: http://forum.simflig...cusim-commands/ I've also spent some time getting to know Linda and how "her" screens work and how to hook the MCP Combo into various switches and dials using different methods. Here's some assumptions I am making so far, please correct me where I go wrong! So I think I understand the concepts I need to in order to get a switch or a knob to work on the MCP Combo. I understand that FSX will either use an "FSX Control" or an LVar to achieve something. The LVars are created by the developer of the add-on. In some cases the developer may also create "FSUIPC Offsets" which help even more, as they can be more "accurate" than perhaps FSUIPC Mouse Macros or Keyboard Assignments. I don't understand whether LVars are better/more useful than Offsets, nor do I know if they are more accurate/native to the add-on/FSX. I do know that in this situation Flight1 have not provided any Offsets for the Cessna Mustang, but there are a certain amount of LVars that we could no doubt tap into. I also see that this add-on makes use of both FSX Controls and LVars - I have seen this during the "Hunting" in LINDA.... So what I need to understand more now is how to get the LVars to do something. From what I've studied so far I can see how it's possible to "profile" a switch in the FSX VC to see what actions occur when a switch is pushed to a particular position, or indeed simply toggled. I also understand that depending on whether a switch is going "On" or "Off" the various actions that are performed may be different, which means this must be taken into account when profilng those switches. I think I understand the Syntax and logic of the switches reasonably well with regard to LVars - given that a switch will have a value of say either 0, 1 and possibly 2 for a three-way switch with corresponding FSX Controls used as a result - this certainly seems to be the case with the Cessna Mustang anyway. What completely stumped me this afternoon though (and this is what I have been building up to!) was how to create LVar logic to manipulate a dial/knob using LVars. For example, I must have spent a couple of hours looking at the VsWheel in particular. When the aircraft is in VS mode I can see in the LINDA Traces that the V/S wheel when scrolled (Up) using the mouse the trace will output something like: [L] LVar: VsWheel = 0[L] LVar: VsWheel = 10[L] LVar: VsWheel = 15[L] LVar: VsWheel = 20[L] LVar: VsWheel = 25[L] LVar: VsWheel = 30 etc, etc What I must note here is that the FSX Control AP_VS_VAR_INC is also output with it, the value does go up in the Garmin gauge and the FD follows it too. If I scroll down using the mouse on the VsWheel however I get something like this: [L] LVar: VsWheel = 25[L] LVar: VsWheel = 20[L] LVar: VsWheel = 15[L] LVar: VsWheel = 10[L] LVar: VsWheel = 5[L] LVar: VsWheel = 0[L] LVar: VsWheel = 99[L] LVar: VsWheel = 94[L] LVar: VsWheel = 89[L] LVar: VsWheel = 84 So the number changes depending on whether you are "Retreating" past 0, starting at 99 in increments of 5 - but if you are "Advancing" past 0 (12 o' clock position) then the number increases as normal increments of 5. I have no idea if this behaviour needs to be mimicked exactly the same or indeed what the purpose is. In fact, why do LVars exist if the switch/dial/knob is going to use an FSX Control anyway? Is it simply to "see" the action performed in the 3rd party gauge? You can probably see whaere I am going with this, but: Could I figure out how to set these numbers and make my V/S knob on my MCP Combo do anything like this? No, not yet. Not even close!! But for one days research I think I've done pretty well. If you could help me with some understanding of the "hows" and "whys" I think I will be able to make some good progress and even possibly contribute to this forum in terms of other LINDA modules in the future. Thanks Guenter. Kind regards, James Gillies

Share this post


Link to post
Share on other sites

Hello James, uhhh long post and many questions...You try to understand the complete whole thing, isn't it? happy.png I will answer in my own words, not answering every specific question, and I hope I can clear thing a bit up. First, the mustang is one of the heaviest aircrafts to start with, because it is really not easy.If you have maybe an A2A aircraft, things are much clearer to see. But anyway, I try to give some explanations (not specially for the mustang): Addon developers use different approaches ot reach theit hings they want do.Honestly I have no clue how they do that, not do I know how FSUIPC will do(and LINDA is nothing more than FSUIPC)I think it has on the developers side sth. to do with XML coding etc... Nevertheless we have now FSUIPC (LINDA) which shows us something when we press a knob in the VC the easiest way is that LINDA shows a LVar (LUA Variable), here as exampleL:Battery = 0 (or 1) So you make a simple function (in LINDA) like: function Testplane_Batt_on () ipc.writeLvar("L:Battery", 1) end in the LINDA editor, you can now use your second mouse button and click on the function Testplane_Batt_on () and this fucntion will be executed in FSX (for testing purposes)You can also assign this to a button and look if it works. finished! Your first function! But things are often that easy... when you have Lvars and controls tracing enabled in LINDA with the Mustang you will see, that there will many other things happen.We have there the Lvar "MASTERBATT" and also the control number 66241 (which is for TOGGLE_MASTER_BATTERY) In case of the Mustang, the Lvar only moves the 3D model of the VC switch(and maybe some background things which I do not know)So ipc.writeLvar("L:MASTERBATT", 1) will trigger the switch up and the parameter 0 will trigger the switch down. You can also assign now onlyipc.control(66241)and you will toggle the battery system in the Mustang on or off!But the switch will not move! So, to have everything working together we will need both: function F1Must_Batt_on () ipc.writeLvar("MASTERBATT", 1) ipc.control(66241) endend Now, the battery system AND the switch is working! BUT:66241 is a toggle function, means it will switch on or of the battery despite the switch state.So, we need to know if the battery is on or off... Why not asking!? ipc.readLvar("MASTERBATT") gives you the current state of the switch (1 or 0)So, we tell the function just to execute the toggle, when the switch is off (MASTERBATT = 0) function F1Must_Batt_on () if ipc.readLvar("MASTERBATT") == 0 then ipc.writeLvar("MASTERBATT", 1) ipc.control(66241) endend The complete function for the Mustang is function F1Must_Batt_on () if ipc.readLvar("MASTERBATT") == 0 then ipc.writeLvar("MASTERBATT", 1) ipc.control(66241) ipc.control(65823, 2) -- knob sound ipc.control(65823, 0) -- knob sound end DspShow("Batt", " on ")end You see also, that we have a third culprit, the knob sounds - also triggered by a control number. The parameter (e.g. "2") gives different sounds for the VC switches. All these stuff is absolutely developer dependent! They use what they want:PMDG used the control ROTOR_BRAKE with different parameters, A2A uses Lvars, others a combination of both and then you can also bring offsets in. Nobody can say what will work ... just try and see. ----------- You are stuck too much with the rotary knobs of the Mustang (like the VS dialer)Choose others for the beginninghappy.png You have to program a counter for these kind of switches like "read knob stateadd +1 to the knob statewrite knob stateif knob state is 100 then begin from zero" And - as I said - the Lvars for the knobs and switches in the Mustang ar only for the 3d Models i the VC.They do not do anything!!! I will try tomorrow to find out how they work. ----------- As for the displays:same thing: we need something the developers will give us: a Lvar which gives us e.g ALT = 10000 will enable us to send it to the MCP Combo. Without such things, we couldn't do anything!And I haven't found anything. ------------- I hope I have answered your questions - I'm not sure!Feel free to ask again!


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hi Guenter,Thank you so much for taking the time to explain to me the various points you made, it has helped massively. I know have a much bett understanding of what is happening as you have confirmed many of my suspicions. I fully accept that perhaps I was "going for the jugular" with regards to the VS Wheel - I figured that I would need to have some sort of routine as you described to determine what the current number is, then add to it and then feed it back to FSX - but then ONLY if it's below a certain number.Thanks for the samples you have given me, I will start to look at building the various switch functions using this as a starting point. It will be good practise to understand the behaviour when a particular switch is activated and deactivated. Once I have done some more work I will show you how far I've got and when you feel you can show me more I will be happy to learn some more. Thanks again for taking the time to help. Kind regards,James Gillies

Share this post


Link to post
Share on other sites

You are welcome!


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Here is an example for the HDG bug increase function

-- ## Autopilot dials ###############function F1Must_HDG_inc ()	F1HDG = ipc.readLvar("ApHdgKnob")	F1HDG = F1HDG + 5	F1HDG = ipc.writeLvar("ApHdgKnob", F1HDG)  	ipc.control(65879)  	ipc.control(65823, 4) -- knob sound  	ipc.control(65823, 0) -- knob soundend

what I haven't found out till now is the Altitude change ... absolute no idea how this is working...


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hi Guenter, I have been looking at this example you have given me - it works very well, both in the gauge the values are updated in a nice, quick fashion and so the dial turns also using the LVars. However, there is another rule(s) to the logic that we must build for it to work fully. The dial wants to have a value of "0" at the top position (think of this as twelve o'clock.) The dial can turn in either direction with the LVar increasing or decreasing by a factor of 5 each time. However, if increasing from: 80859095... The next value must be "0". So clockwise the valid values are: 051015202530354045505560657075808590950 Anti-clockwise the valid values are: 09994898479746964595449443934292419149499 The way the function is built at the moment is when the LVar value goes beyond "100" the dial will stop turning, although the FSX Control still works. So I think we need to build in a condition or two that will either: 1.) Loop over at 95/100 and force it back to a value of "0" - when increasing. Otherwise just keeping adding 5 like we do presently.2.) When decreasing - When it gets to 0 minus 1 so that the value is "99" - then if the value is "99" minus 5 to set a value of "94" etc etc etc3.) When it gets to a value of "4" when decreasing set a value of "99" I think I can build the logic that will do this a a few rules - but I'll need to understand the syntax of the "if" and "then" statements - I have seen some other examples, but I wonder if there is a more elegant way of doing this with creating an "if" and "then" statement for each and every position of the dial? What is your opinion on how to best tackle this? Thinking about this some more we might be able to set some simpler conditions that just monitor for either the values of 95, 99, and 4. If the value is 0 then it will add 5 anyway......... 1.) Monitor "95" so that the next value is "0" - on the Inc function.2.) Monitor "4" so the the next value is "99"- on the Dec function.3.) Monitor "99" so that the next value is "0"- on the Inc function. The circle will be complete. What do you think? Have I got a head for this? Cheers Guenter. Kind regards, James Gillies

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...