joshuamarius Posted December 13, 2019 Report Posted December 13, 2019 (edited) FSUIPC 4.974 - Registered User FSX: SE Add-On Aircraft: Flight 1 Citation Mustang V2 I did quite a bit of searching and testing before I decided to post here and hope I can get some help. Thanks Pete for such a great product! I have never had problems with FSUIPC in either FSX:SE or Prepar3d v4. I've made Mouse Macros work wonderfully with encoders, Keyboard shortcuts, etc and everything has worked as expected. I am now getting into more advanced stuff. I have a custom made AutoPilot hardware Panel which allows the basics (Approach, AP Master ON, HDG Hold, etc). I am interfacing with MobiFlight and custom made variations of the same, most of the offsets are easily obtained and LEDs light on correctly depending on what is being enabled. So far so good. However, on this aircraft, when I look at FSUIPCs output log, If I enable the Flight Director or the Alt Hold, I see the appropriate entries and they work beautifully: 7784125 *** EVENT: Cntrl= 65808 (0x00010110), Param= 0 (0x00000000) AP_ALT_HOLD_ON 7505515 *** EVENT: Cntrl= 66288 (0x000102f0), Param= 0 (0x00000000) TOGGLE_FLIGHT_DIRECTOR However, when I click some of the other buttons within the 3D Cockpit, they generate the same exact output with a different parameter. For example, pressing APR, BC, SPD or FLC produce the following: 6676625 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 51 (0x00000033) THROTTLE4_SET 7602218 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 55 (0x00000037) THROTTLE4_SET 7615812 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 10 (0x0000000a) THROTTLE4_SET 7801687 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 63 (0x0000003f) THROTTLE4_SET This of course is a problem. If I want to enable the LED light as soon as I hit approach, there is no way for me to program this as I need the exact Offset to be outputted, for example: 0800 I did play around copying and pasting some of the outputs above and did get one of the LED lights to come on but it cannot be controlled since the output is the same. Is there anything that can be done to either manipulate or use the output the same way as the pre-set ones in the simulator and fsuipc? It's very easy for me to create a mouse macro, keyboard shortcut, use an Event ID, or modify the input.ini for the aircraft and push the buttons, so this is not a problem; the problem is I need an offset to trigger the Output LED in Mobiflight. Can this be done? Should I go another route, LUA, etc.? I hope this makes sense and thanks for any help you can provide. Edited January 12, 2020 by joshuamarius Added 'Registered'
Pete Dowson Posted December 13, 2019 Report Posted December 13, 2019 5 hours ago, joshuamarius said: However, when I click some of the other buttons within the 3D Cockpit, they generate the same exact output with a different parameter. For example, pressing APR, BC, SPD or FLC produce the following: 6676625 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 51 (0x00000033) THROTTLE4_SET 7602218 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 55 (0x00000037) THROTTLE4_SET 7615812 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 10 (0x0000000a) THROTTLE4_SET 7801687 *** AXIS: Cntrl= 65823 (0x0001011f), Param= 63 (0x0000003f) THROTTLE4_SET Just to clarify, are these buttons on the "3D cockpit" clicked with a mouse on screen? Or on your custom made hardware A/P panel? If the latter, then I can't help with this information because I've no idea how you've programmed those buttons. If you mean buttons on the screen cockpit, then I think there must be a fault in that add-on aircraft code. You go on to say: 5 hours ago, joshuamarius said: This of course is a problem. If I want to enable the LED light as soon as I hit approach, there is no way for me to program this as I need the exact Offset to be outputted, for example: 0800 You talk about "offsets", but how are you using such? Are you monitorin the offsets documented for the data you want? Are you only concerned about lighting an LED, or about the function being performed and indicated by the LED? Or perhaps you are mixing up "offsets" (which are locations in memory, listed on the provided offsets document), and "controls" or "events". The log parts you show are Events or controls, nothing to do with Offsets. 5 hours ago, joshuamarius said: the problem is I need an offset to trigger the Output LED in Mobiflight. So your Mobiflight (which, I'm sorry, I know nothing about) is some sort of hardware driver which you configure by specifying offset values? There are defined offsets dealing with the default built-in autopilot, including APR, BC, SPD (as you say, 0800 for APR). So i'm assuming that the add-on aircraft you are concerned with has it's own autopilot programming and doesn't use these built-in FS facilities. If that is correct then you are dependent upon whatever information is available from the aircraft makers. They are most unlikely to be mapped into FSUIPC offsets. If you can operate those modes by buttons on your hardware then you may only be able to set or clear the LED indications depending on whether you set or clear the mode. Pete
joshuamarius Posted December 14, 2019 Author Report Posted December 14, 2019 Pete, thanks so much for the quick response and sorry I left so many things unanswered. I think you may have answered my question. The FSUIPC output lines I put in my post are from clicking on buttons in the 3D Cockpit and obviously these are out of whack because a few of them trigger the same action. To answer your question, I am wanting an input (press of a button or switch) to cause a specific output, in this case turn on an LED. Currently, the offsets are being used the following way by Mobiflight (very useful program for interfacing with Arduino cards). Let's say I have an example button 1: Input: Press button 1 > trigger 0x07BC offset > Enables AP Master in Sim/Aircraft Output: Monitor offsets, when 0x07BC is triggered, enable LED1 (AP Master LED) You can also do: Input: Press button 1 > trigger Event ID 65580 (AP Master) Output: Monitor offsets, when 0x07BC is triggered with the above, enable LED1 (AP Master LED) So far so good! You can also do SimConnect variables. This works beautifully. However, because of what you have mentioned above, the aircraft definitely has a fault because when you press certain buttons in the 3D Cockpit, a generic action seems to be outputted, which has nothing to do with the label of said button. So clicking on V/S or FLC buttons trigger THROTTLE4_SET :( instead of outputting the V/S Offset, etc. Is there anyway to use any of the parameters outputted in the logs to produce the desired output? Or maybe anyway to modify the Aircraft cfgs and force those buttons to produce the desired offsets? Maybe obtain the parameter as shown in the log, and if that happens trigger a specific offset? Example: the V/S button generates Param= 63 (0x0000003f) as seen in the log, this is read as a variable, checked, and depending on the parameter, the right offset is sent out: 0x07EC (Vertical speed hold). Just throwing out some ideas. Any help is greatly appreciated. Please let me know if you need more clarification on my side. Thanks.
Pete Dowson Posted December 14, 2019 Report Posted December 14, 2019 22 minutes ago, joshuamarius said: the aircraft definitely has a fault because when you press certain buttons in the 3D Cockpit, a generic action seems to be outputted, which has nothing to do with the label of said button. So clicking on V/S or FLC buttons trigger THROTTLE4_SET 😞 instead of outputting the V/S Offset, etc. I think that, maybe, because if they used the regular controls for those actions the affect in the default Sim code could affect their aircraft too, they instead "invented" the use of an otherwise unused control (no 4th Engine, right?) to operate those facilities. If that is the case then I would assume that the parameter would differentiate between the actions. 25 minutes ago, joshuamarius said: Is there anyway to use any of the parameters outputted in the logs to produce the desired output? Well, the best would be to get your driver to react to the Throttle4 setting being made. he value should appear in the Engine 4 N1% offset. Otherwise you could have a Lua program to trap those Throttle4 controls (event.control) and write whatever offset you wnted. BUT if your driver needs the original A/P function offsets to be set then be aware that this might mess up the aircraft's operation -- there's presumably a good reason for them to have avoided changing them. Pete
joshuamarius Posted January 12, 2020 Author Report Posted January 12, 2020 Pete, can't thank you enough for all your help. With a mixture of FSUIPC and an input.ini file made specifically for this Aircraft I have almost completed the interfacing with several components. I do have a few questions and please excuse me if they are very basic but I have not found direct answers to these questions in the forum or documentation. I am still learning FSUIPC. 1) The Mouse Macros have come in VERY handy because since the output of some actions in this Aircraft are not standard, they can be triggered with the Macros. So the question is, I see each macro is assigned a string, is there a way to monitor these strings and modify a custom offset when they are triggered? 2) Regarding the Engine 4 N1% parameters we mentioned above, is there a way to monitor these parameters and modify another offset? I have seen sample LUA scripts of writing to an offset, but what about reading and modifying specifically the parameters? The parameters are unique values so if there is a way to do this, I have solved my problem. 3) Combing the forums I read some FS Controls may not have an offset assigned. Is there a way to tell this by looking at the log/console Window? So for example: 198438 *** EVENT: Cntrl= 65580 (0x0001002c), Param= 0 (0x00000000) AP_MASTER I can see in the above line the control 65580 is Autopilot Master, but how would I know the actual offset by looking at the log, or do I have to look it up in the list (07BC) ? Thanks again for your time on this.
Pete Dowson Posted January 12, 2020 Report Posted January 12, 2020 3 hours ago, joshuamarius said: The Mouse Macros have come in VERY handy because since the output of some actions in this Aircraft are not standard, they can be triggered with the Macros. So the question is, I see each macro is assigned a string, is there a way to monitor these strings and modify a custom offset when they are triggered? Sorry, i'm not fully understanding. What "string"? Can you give me an example? Macros don't trigger themselves. You assign them to buttons or key presses. There are event functions in Lua which can trap those. But surely if you want an offset changed instead of the mouse click to be emulated, why bother with the mouse macro in the first place? 3 hours ago, joshuamarius said: Regarding the Engine 4 N1% parameters we mentioned above, is there a way to monitor these parameters and modify another offset? event.offset will trigger when an offset is changed. You can write to offsets using the ipc library functions. Please refer to the Lua library document. 3 hours ago, joshuamarius said: Combing the forums I read some FS Controls may not have an offset assigned. Controls are not Offsets and vice versa. Offsets provide values and can, like controls, trigger actions when changed. Some of those actions may actually use controls, internally to FSUIPC, but many don't. There are many offsets which provide or change values which have nothing to do with controls -- eg, all the Weather stuff. 3 hours ago, joshuamarius said: 198438 *** EVENT: Cntrl= 65580 (0x0001002c), Param= 0 (0x00000000) AP_MASTER I can see in the above line the control 65580 is Autopilot Master, but how would I know the actual offset by looking at the log The EVENT logging is just that. It sees the event being triggered in the Sim, no matter whaere it came from (that isn't discernible in any case), and since it is only an event, a transient thing, what offset gets changed as a result is also unknown. One event might cause many offsets to change (eg throtle changes, flight control operation, etc). Even something seemingly simple like AP_MASTER will likely change many things . To determine the state of the aircraft, indeed the entire sim, you look at offsets, and the offset list is the reference for this. To operate the sim you use controls or events, or in some cases, writes to offsets. Pete
joshuamarius Posted January 13, 2020 Author Report Posted January 13, 2020 16 hours ago, Pete Dowson said: Sorry, i'm not fully understanding. What "string"? Can you give me an example? As an example I created a new Mouse Macro, pressed a button on the Autopilot, and the result was: RX9f260*X55cc,22 Log: User Macro: 0TEST=RX9f260*X55cc,22 I know this is manually triggered by a keypress, but, is there anyway to refer to the string/code above and trigger it automatically? So as a crazy example, I press Button 5 on joystick, the above happens as expected. Or, as an automatic action, something happens on the Sim (level off, etc), an offset is modified, most liely custom, which in turn refers to and enables the macro automatically. I'm just looking at my options to fool the sim into getting the results I need. Now, interestingly enough, I took your advice and referred to the LUA Library Document. I saw a zip file named Example LUA plugins, to my amazement, there is a LUA plugin in there: F1MustangSwCtl.zip - The plugins describe exactly what I was looking for but for a different Autopilot hardware unit. The script solves the problem with the exact method I was thinking of implementing, but just needed to learn how to do it in LUA, and there it is laid out! All this time...WOW! I will start working on it and let you know if I need further assistance. Thanks again for your time and answering my questions.
Pete Dowson Posted January 13, 2020 Report Posted January 13, 2020 3 hours ago, joshuamarius said: As an example I created a new Mouse Macro, pressed a button on the Autopilot, and the result was: RX9f260*X55cc,22 Are, they are numbers. R just stands for Reference, X is for heXadecimal, 9f260 is the offset in the Gauge file to the function to be executed (which is why mouse macros have to be re-made if you update the aircraft), 55cc is a check value, to make to sure memory at that point is correclty indicating the entry point to avoid a crash if you do update), and 22 is the mouse action code -- see the list in the Advanced User's guid. 3 hours ago, joshuamarius said: I know this is manually triggered by a keypress, but, is there anyway to refer to the string/code above and trigger it automatically? No, because there's a lot more to it than simply causing a jump to that part of the code. 4 hours ago, joshuamarius said: Now, interestingly enough, I took your advice and referred to the LUA Library Document. I saw a zip file named Example LUA plugins, to my amazement, there is a LUA plugin in there: F1MustangSwCtl.zip - The plugins describe exactly what I was looking for but for a different Autopilot hardware unit. The script solves the problem with the exact method I was thinking of implementing That uses "L:Vars", which isn't in any way the same as calling a function normally called by a mouse click. There are lots of things which may be indicated and controlled by L:Vars, and these often do overlap with the mouse click spots in a cockpit. Where they do the job you want they are more relaible than Mouse Macros and will normally be okay across updates. There's a spacial control you can assign in FSUIPC to list all the L:Vaars in a cockpit, and their current values, and, better, a Lua plug-in you can run to monitor changes in them and show these on screen ("Log lVars.lua"). BTW in P3D4, Lockheed Martin kindly made the "mouse macro" method officially supported with new facilities, and these thereby became more reliable and don't necessarilty change just with updated gauges. Before this the facility was most definitely an ugly hack. Pete
joshuamarius Posted January 16, 2020 Author Report Posted January 16, 2020 Thanks again for the help! Made a lot of progress after extracting all of the LVARS using the script you recommended. Then wrote a few LUA scripts and the interfacing is behaving as expected, but now I have to dig into the complex if/then/else loops, etc. I searched the forums and read the LUA library and it wasn't specified very well how to monitor if a control has been executed. Maybe I missed something. To be more specific, as the aircraft levels off, two controls are executed to disable the Vertical Speed select automatically. When this happens, I would love to turn the LED OFF, so in Psuedo-code: If ipc.control(65823, 1) and ipc.control(65823, 2) are executed, then write to custom offset to turn off LED. Unfortunately It has to be those specific controls with those specific parameters. Can this be done? Any ideas are welcome.
Pete Dowson Posted January 16, 2020 Report Posted January 16, 2020 4 hours ago, joshuamarius said: I searched the forums and read the LUA library and it wasn't specified very well how to monitor if a control has been executed. Maybe I missed something. You missed "event.control". The functions in the event library are listed in alphabetical order. It's on page 24 in my copy. 5 hours ago, joshuamarius said: so in Psuedo-code: If ipc.control(65823, 1) and ipc.control(65823, 2) are executed, then write to custom offset to turn off LED. Is you Lua code sending those controls? If so, no need to detect them as you'll know. Pete
joshuamarius Posted January 16, 2020 Author Report Posted January 16, 2020 Yes, the LUA scripts have been working properly and I have been using event.control successfully, but I just realized I worded that in a confusing way. What I am trying to do is monitor if these controls have been executed, not execute them. The test LUA scripts I wrote that get called up by button presses successfully execute the event.control, but, the Aircraft itself also executes these controls automatically without my input. Let me describe a sequence as an example: Press Button 1 > Execute event.control(65823, 1) > Write to custom offset which turns on LED (As example, this tells the aircraft to climb to 5000 ft) The aircraft Climbs to 5000ft and while leveling , it then automatically executes event.control(65823, 1) How do I monitor, or capture that this event.control(65823, 1) has taken place and write to my custom offset to turn the LED off? Another example I can think of is let's say I wanted to count the amount of times event.control(65823, 1) has been executed since the flight began. (Start monitoring) event.control(65823, 1) is executed Counter = 1 event.control(65823, 1) is executed Counter = 2 event.control(65823, 1) is executed Counter = 3 ...etc... (end monitoring) Hopefully that makes better sense. Thanks again for your time.
Pete Dowson Posted January 16, 2020 Report Posted January 16, 2020 22 minutes ago, joshuamarius said: How do I monitor, or capture that this event.control(65823, 1) has taken place and write to my custom offset to turn the LED off? It isn't "event.control(65823, 1)"!!! Please do read the documentation! The second parameter it the name of the FUNCTION you want to be called when that event occurs! In that function you can checvk the parameter and act accordingly! Pete
joshuamarius Posted January 17, 2020 Author Report Posted January 17, 2020 Sorry Pete! I meant ipc.control(65823, 1) - Sorry about that! That's what I need to monitor; basically this aircraft uses that control to automatically disable certain autopilot functions. I would like to set a custom offset based on the ipc.control executed with its parameter. So... ipc.control(65823, 57) Disables Autopilot - Capture that, write to custom offset 0x66C5 (Turn LED OFF) ipc.control(65823, 60) Disables Vertical Speed, etc...capture that, write to another offset 0x66C4 (Turn LED Off) I can see these events taking place in the FSUIPC log, and since it's the same control (65823) all I can do is monitor the parameter to act accordingly. Now, I know if you look these controls up they do not match the description of the action as 65823 is THROTTLE4 SET, but the parameter is captured by some code in the gauge and acts accordingly (it is not sent to the FS or LVARs). I would like to capture that and write to the offset to trigger the LEDs. This is the last component, I am 98% done with the Autopilot Panel, SO CLOSE! Thanks again.
Pete Dowson Posted January 17, 2020 Report Posted January 17, 2020 38 minutes ago, joshuamarius said: That's what I need to monitor; basically this aircraft uses that control to automatically disable certain autopilot functions. I would like to set a custom offset based on the ipc.control executed with its parameter. So, use event.control as I said! The one you "missed" as I pointed out in my earlier reply yesterday. That is exactly what it is for! Pete
joshuamarius Posted January 18, 2020 Author Report Posted January 18, 2020 I got it working! 😁 Managed to get the controls monitored and offsets adjusted accordingly. Unfortunately it took me a bit because I had to google around for a while because I could not find examples of what I was trying to do. There are no examples of the event.control in action in the Example LUA Plugins folder either 😞 I stumbled across another post on here and followed the syntax. I can't believe I got this to work! Once I'm done ill publish my findings and hopefully help out others. Thanks for your help!
Pete Dowson Posted January 18, 2020 Report Posted January 18, 2020 19 minutes ago, joshuamarius said: Unfortunately it took me a bit because I had to google around for a while because I could not find examples of what I was trying to do. Sorry, but is the cocumentation for the function not understandable? If it isn't maybe I should get it improved. As for techniques for using events I'm sure there are plenty of examples available, if not so many in the supplied ZIP, certain in the Forum (mostly in the User Contributions I think). Your questions were not really asking about how to use events, but more as if you hadn't seen the existence yet of event.control. Pete
joshuamarius Posted January 22, 2020 Author Report Posted January 22, 2020 On 1/18/2020 at 3:59 AM, Pete Dowson said: Your questions were not really asking about how to use events, but more as if you hadn't seen the existence yet of event.control. Pete I've programmed in quite a bit of languages so for me this was not so new, but tying it all up was definitely overwhelming. I can't imagine how difficult it would be for somebody that has never programmed. The manuals definitely helped in finding the events, understanding offsets, etc., but often left me asking more questions such as "where". Some manuals are in desperate need of an Index as I would scroll up and down going crazy trying to find information after failed searches. I also noticed that a lot of the FAQs I had were the subject of many repeated topics in the forum that I really could not find in any of the manuals. When I found the existence of event.control, I still had tons of questions and as I pointed out, could not find an example in any of the included scripts. I had to comb the forum and read through about 8 - 10 topics to finally come across somebody attempting the same. But I understand, it is a learning curve. I'm willing to send you an email with my experience. I can now help in the forums and willing to volunteer my time in any way I can help. Also, do you have any language files for FSUIPC? I am willing to volunteer my time to get the main application, manuals, and comments in scripts/examples translated to Spanish and even open a Spanish section in the forum. I think that would be tremendous for the community...and well...your sales 😉
John Dowson Posted January 27, 2020 Report Posted January 27, 2020 On 1/22/2020 at 7:41 AM, joshuamarius said: I also noticed that a lot of the FAQs I had were the subject of many repeated topics in the forum that I really could not find in any of the manuals. On 1/22/2020 at 7:41 AM, joshuamarius said: I'm willing to send you an email with my experience. If you are willing to write some new FAQ entries based on your experience then that would be great! If you could email them to me when done, I will create some new FAQ entries from them. You can PM them to me, or email me directly. On 1/22/2020 at 7:41 AM, joshuamarius said: I can now help in the forums and willing to volunteer my time in any way I can help. The forums are open to all and we actively encourage people to follow and post replies/solutions, so please respond to any requests that you are able to help out with. On 1/22/2020 at 7:41 AM, joshuamarius said: Also, do you have any language files for FSUIPC? I am willing to volunteer my time to get the main application, manuals, and comments in scripts/examples translated to Spanish and even open a Spanish section in the forum. Currently no language files for FSUIPC. I am planning on updating the UI for future versions, and I would certainly like to include internationalisation in the UI when I do this. When I get around to this, I'll PM you for some help on the spanish files. I do speak reasonable Spanish, as I live in Spain, but not at a good technical level. I am also planning to refresh the User Manuals very shortly, to make them more general to support the various different planned FSUIPC versions (5 and later), and also add section/header numbers and maybe an index. We can maybe thing about translating these once done, although that would be quite a large job! Probably only worth doing initially for the User Guide, and maybe later the Advanced User Guide. Not sure about a specific Spanish section in the forum - let me think about it a bit more. We do occasionally get support requests in Spanish, as well as other languages, which we do our best to respond to. Maybe something worth looking into once we have the internationalisation in the UI. Thanks a lot for your generous offer! Regards, John
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