Delta14Sierra Posted April 27, 2011 Report Posted April 27, 2011 (Sorry...this is a duplicate post. I initially posted it under Flight Simulator 10). While trying to get a couple of my GoFlight LEDs on my GF-P8 to act as Flap Indicator Lights, I came across the following inconsistency/typo listed in the "FSUIPC4 Status of IPC Offsets for FSX" PDF: 0BDC - 4 - Flaps control, 0=up, 16383=full. The "notches" for different aircraft are spaced equally across this range: calculate the increment by 16383/(number of positions-1), ignoring fractions. See also offset 3BFA below. 3BFA - 2 - Flaps détente increment. The full range of flap movement is 0–0x3FFF (16383). Each détente position or "notch" is spaced equally over this range, no matter what flap angle is represented—a table in the AIR file gives those. To obtain the number of détentes, divide this increment value into 16383 and add 1. For example 2047 (0x7FF) would be the increment for 9 positions. I could not get the first flap indicator to light using the equation as listed for offset 0BDC (16383 divided by 2 minus 1 equals 8190). However, it now works using the equation listed for offset 3BFA (16383 divided by 2 plus 1 equals 8192). It would seem to me that the minus 1 (in 0BDC) should be changed to plus 1 (as in 3BFA). Below you will find the working LUA script which I have included in ipcReady.lua. BTW, I only use the first few GF-P8 buttons for ATC instructions so those LEDs never stay lit. Caveat: If I use either ATC1 or ATC2 while the appropriate Flap Indicator Lights are lit, they will cancel out the respective LED acting as the Flap Indicator Light. But that is a consequence I will have to live with. Of course, you can choose any of the LEDs you want. (Now, on to trying to get LEDs to light for Cowl Flaps and NAV/GPS. Any help with correctly identifying these offsets would be most appreciated.) -- LED-1-Flaps1 function Flaps1(offset, value) if value == 8192 then gfd.SetLight(GFP8, 0, 0) else gfd.ClearLight(GFP8, 0, 0) end end event.offset(0x0BDC, "SW", "Flaps1") -- LED-2-Flaps2 function Flaps2(offset, value) if value == 16383 then gfd.SetLight(GFP8, 0, 1) else gfd.ClearLight(GFP8, 0, 1) end end event.offset(0x0BDC, "SW", "Flaps2")
Pete Dowson Posted April 27, 2011 Report Posted April 27, 2011 I could not get the first flap indicator to light using the equation as listed for offset 0BDC (16383 divided by 2 minus 1 equals 8190). You seem to be misreading it. As it states, it is talking about computing the increment value, the one as displayed in the flaps calibration section of FSUIPC options. The increment value depends on the number of positions. It there are only 2 positions, as you are saying, then the increment is 16383 divided by (2 minus 1) = 16383. Obviously! Because the two positions are 0 and 16383. They have to be! However, it now works using the equation listed for offset 3BFA (16383 divided by 2 plus 1 equals 8192). You most certainly are not reading what it says. It is telling you how to compute the number of positions (detentes) from the given increment. The two so-called "formulae" are identical, just inverses of each other. One relates positions to increments, the other increments to positions. As such they tell you how the value in one offset relates to the value in the other. They are, in fact, both derived from the same FS value in the first place by code in FSUIPC using this relationship! BTW, I only use the first few GF-P8 buttons for ATC instructions so those LEDs never stay lit. Caveat: If I use either ATC1 or ATC2 while the appropriate Flap Indicator Lights are lit, they will cancel out the respective LED acting as the Flap Indicator Light. But that is a consequence I will have to live with. Of course, you can choose any of the LEDs you want. Sorry, you've lost me there. if you take full control over the GF-P8 LEDs you can light them or extinguish them as you wish. (Now, on to trying to get LEDs to light for Cowl Flaps and NAV/GPS. Any help with correctly identifying these offsets would be most appreciated.) Offsets showing what? cowl flaps positons are there for each engine -- just search on the word "cowl". And a search on "GPS" will find your NAV/GPS switch in no time. Regards Pete
Delta14Sierra Posted April 27, 2011 Author Report Posted April 27, 2011 Thank you for the clarification. I was, indeed, reading it the wrong way.
Pete Dowson Posted April 27, 2011 Report Posted April 27, 2011 Thank you for the clarification. I was, indeed, reading it the wrong way. Okay. I trust you found the cowl flaps and NAV/GPS switch information you were after? Regards Pete
Delta14Sierra Posted April 27, 2011 Author Report Posted April 27, 2011 I was able to get the LED on my GoFlight module to light when toggling from NAV to GPS. Thank you so much for your direction. I have not yet begun to work on the Cowl Flaps, but will begin on that in the next day or so. (I am hoping to get an LED to light on my GoFlight GF-T8 to light when using the LUA script found on the forum under the title: "Lua file cowl flaps switches Duke B60 solved"). However, I am currently trying to get an LED to light on one of my GoFlight modules when toggling Marker_Sound_Toggle. But I am at a loss as to the correct value I need to enter the LUA script for when the Marker_Sound_Toggle is turned on. Understanding that 2^2 is 2 squared, I have tried using 4, but that does not work. Any insight that you could provide as to where I need to look for the proper value, I would most appreciate it. I have learned a lot lately, but I have a long way to go. function MarkerIdent(offset, value) if value == 132 then gfd.SetLight(GF166, 0, 2) else gfd.ClearLight(GF166, 0, 2) end end event.offset(0x3122, "SB", "MarkerIdent") I got the 132 from logging 3122: 8201644 Monitor IPC:3122 (U8) = 132 8201644 SimRead: 3122="MARKER SOUND" INT32: 1 (0x00000001) 8202642 Monitor IPC:3122 (U8) = 128 8202642 SimRead: 3122="MARKER SOUND" INT32: 0 (0x00000000)
Pete Dowson Posted April 28, 2011 Report Posted April 28, 2011 However, I am currently trying to get an LED to light on one of my GoFlight modules when toggling Marker_Sound_Toggle. But I am at a loss as to the correct value I need to enter the LUA script for when the Marker_Sound_Toggle is turned on. The toggle control is a control to toggle the marker sound on or off. A control cannot itself be "on" or "off", it is only a control. I assume you mean the switch setting in offset 3122? Understanding that 2^2 is 2 squared, I have tried using 4, but that does not work. Er, how are you trying to use '4'? Show me. In this: function MarkerIdent(offset, value)if value == 132 then gfd.SetLight(GF166, 0, 2) else gfd.ClearLight(GF166, 0, 2) end end event.offset(0x3122, "SB", "MarkerIdent") I got the 132 from logging 3122 3122 will only ever = 132 when all of the sound switches are off except Marker sound, and the COM1 transmit is set. This is because 132 = 128 + 4 = 2^7 + 2^2. Look up those two bits in the 3122 description. However, since you are reading 3122 as "SB", a Signed Byte, it will not look like 132 because the 128 (2^7) bit is the sign bit. Instead it will read as -124 ( = 256-132)! You should always check whether you need a signed value (something which can be negative as well as positive, or unsigned. All values containing only individual bits for flags or switches are unsigned as they don't realy represent numbers at all, only a collection of switch settings. In the Lua program if you want to test just one bit you have to use the logic library function logic.And to extract it: if logic.And(value, 4) ~= 0 then I think you should learn a little more about numbers and bits. Check out the little tutorial "About bits, numbers and hexadecimal ..." in the FAQ subforum. Regards Pete
Delta14Sierra Posted April 28, 2011 Author Report Posted April 28, 2011 Works! Thank you so much! You have been most helpful and instructive! I am on my way over to the FAQ forum to download the stated file. I look forward to furthering my knowledge on this matter. Challenging though it is, I am enjoying it!
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