Jump to content
The simFlight Network Forums

Some offsets do not work for all aircraft?


Recommended Posts

Hi guys,

I am building my own panel based on arduino, and I am interfacing it with FSX/P3D through the latest version of FSUIPC. Most of the controls work, but there are a few key controls that do not work for all aircraft, like PMDG 737NGX, A2A P-51, Vans RV-7.

The offsets I am talking about are 0x0bdc for flaps, 0x0bd0 for spoilers, and 0x0be8 for gear. All of these work for default aircraft, and also some add-on aircraft such as RealAir Scout, C90B, Carenado 208, and so on, but not for the aircraft listed above.

Is this because they use some other means of control? Is there perhaps some other offsets I should use instead? Do I have to go to work more manually and emulate the actual key presses in some way? A simple example from my lua script is included below.

Any help is appreciated.


if string.match(str, "flaps:(%d+)") then
state = tonumber(string.match(str, "flaps:(%d+)"))
ipc.writeUD(0x0bdc, state)
end
if string.match(str, "spoilers:(%d+)") then
state = tonumber(string.match(str, "spoilers:(%d+)"))
ipc.writeUD(0x0bd0, state)
end

table.insert(commands, {0x0be8, "gear", ipc.writeUD, ipc.readUD, 0, 16383})
for i,v in ipairs(commands) do
if string.match (name,v[2]) then
ipc.log(v[1])
if string.match (action, "on") then
v[3](v[1],v[5])
states [v[1]] =v[5]
elseif string.match (action, "off") then
v[3](v[1],v[6])
states [v[1]] =v[6]
elseif string.match (action, "toggle") then
current_value =v[4](v[1])
if current_value ~=v[5] then
v[3](v[1],v[5])
elseif current_value ~=v[6] then
v[3](v[1],v[6])
end
else
v[3](v[1], tonumber (action))
states [v[1]] = tonumber (action)
end
break
end
end
[/CODE]

Link to comment
Share on other sites

I am building my own panel based on arduino, and I am interfacing it with FSX/P3D through the latest version of FSUIPC. Most of the controls work, but there are a few key controls that do not work for all aircraft, like PMDG 737NGX, A2A P-51, Vans RV-7.

The offsets I am talking about are 0x0bdc for flaps, 0x0bd0 for spoilers, and 0x0be8 for gear. All of these work for default aircraft, and also some add-on aircraft such as RealAir Scout, C90B, Carenado 208, and so on, but not for the aircraft listed above.

The FSUIPC offsets listed in the FSUIPC SDK are all related to FS functions. Many of the more complex add-on aircraft do their own thing for several, and in some cases, most of the subsystems. I'm surprised you have managed so well that you have only a few omissions, expecially with the PMDG aircraft.

One thing for those specific functions would be to try sending the appropriate Axis controls instead of trying to control directly via offsets. This is because their actions are likely to be determined by the state of other subsystems which are being simulated specifically. The add-on code often intercepts the controls you'd normally assign via FS or FSUIPC and interprets it accordingly. You can use offset 3110 to send FS controls.

The PMDG 737NGX also has a vast number of its own add-on controls -- see the Header file in the SDK installed with their recent update. You might also benefit from checking the assorted user contributions for these aircraft -- see the User Contributions subforum.

Regards

Pete

Link to comment
Share on other sites

Thanks for the clarification. Looking at offset 3110 I'm not entirely sure of how to use it.

Could you be so kind as to give me a simple example for how I would control the flaps given a number available in a variable? Do I have to assign some kind of dummy axis in fsuipc? I would prefer to keep the code as generic as possible, so I would like to avoid addon specific modules. Doing this through axis as you suggest seems like a better way of doing it for me, assuming I can figure out how :)

Edited by kolaf
Link to comment
Share on other sites

Thanks for the clarification. Looking at offset 3110 I'm not entirely sure of how to use it.

You write the parameter for the control (eg axis value) to 3114 then the control number to 3110. Look up the control numbers in the List of Controls installed in your FSUIPC Documents folder. The controls added by FSUIPC are listed in the Advanced User's guide.

Could you be so kind as to give me a simple example for how I would control the flaps given a number available in a variable? Do I have to assign some kind of dummy axis in fsuipc?

Surely you can easily look up the value of the Axis Flaps Set or Flaps Set controls yourself! Please do try! It isn't hard -- there's an alphabetically ordered list and a Numerically ordered list!

If you are doing all this as a Lua plug-in you don't need to use offset 3110 to send controls, just use the ipc.control function. But you still need to look up the value of the control.

Pete

Link to comment
Share on other sites

Thanks, if it is as easy as that, then I will manage :-)

Just one more quick question. There are several controls for the flaps and the spoilers. I'm curious about the function of the control "flaps set". Does this take the same values as the flaps offset I talked about above? Could I then just input a number between zero and 16,000 and have the flaps change accordingly (similar for spoilers)? Or do I have to calculate the number of detentes myself based on input from the other offsets...

Link to comment
Share on other sites

There are several controls for the flaps and the spoilers. I'm curious about the function of the control "flaps set". Does this take the same values as the flaps offset I talked about above?

All the "_SET" controls set a given value, though sometimes it is only a 0 for Off and 1 for On. The Axis_XXXX_Set controls are the current axis controls as used by FS itself. the axis controls without a preceding "Axis_" are old ones, dating back to FS98 or before.

For most things both work fine. The Axis controls have parameter values from -16383 to +16383, but they don't have reverse thrust, reverse prop and so on. The non-"Axis_" axis controls either run from 0 to 16383, or, where there is a reverse (throttle, props) use a negative value for reverse (eg down to -4096 for an aircraft defined with max 25% reverse thrust).

Could I then just input a number between zero and 16,000 and have the flaps change accordingly (similar for spoilers)?

Yes, for the "Flaps_Set" control (-16k to +16k for the axis one), but a flaps control with detentes will move to the nearest actual detente value. You'd have to adjust if you have detentes on your lever. If it is just continuous just move to to get what you want.

There is an offset providing the number of detentes and the write up tells you the computation. Be aware though that the PMDG 737NGX detentes aren't quite in the place computed, unlike the defaults.

You will have to check which of the controls (Axis_ or otherwise) works with the aircraft you want to use. If they are intercepting controls, they may only work with the newer ones (Axis_ ...).

Pete

Link to comment
Share on other sites

Thank you for your awesome help. I now got flaps, spoilers, and gear working for the 737 NGX :smile:.

The flaps are accessed through axis flap set. The weird thing, though, is that this does not control the flaps on the A2A p-51 Mustang. I think the gear works, but the flaps do definitely not work. You said that this was the most generic way of controlling things? It is not a big deal, but still...

Edited by kolaf
Link to comment
Share on other sites

The flaps are accessed through axis flap set. The weird thing, though, is that this does not control the flaps on the A2A p-51 Mustang.

Maybe they only accept flaps INC and DEC, or the old Cessna type 4 flap position settings. I assume you can operate them with the keyboard or mouse? Just enable Event logging in FSUIPC's Logging tab and look at the Log after using the relevant flaps controls.

Pete

Link to comment
Share on other sites

They certainly use the standard button presses for Flaps Inc and Dec - I haven't tried an axis, but can do so later this evening as a test.

There are a lot more than four settings available, but Accu-Sim products also come with their own control allocations application, which overrules/bypasses the FSX default commands, so that is also an option?

Edit: I've done some testing and no, neither the FSUIPC nor default "Flaps" axis control will work with the A2A Accu-Sim P-51D. However the axis can be assigned through the P-51D's configuration utility and works perfectly. Buttons assigned to Flaps Inc and Flaps Dec either through FSUIPC or the default dialogue work perfectly.

Ian P.

Link to comment
Share on other sites

By this I guess that reading the ranges for the flaps from the appropriate offset 3BFAwill not be possible either? I haven't tried, so I guess it is worth a shot. Is there any other way of achieving flaps control from a proportional lever if this is unsuccessful?

Link to comment
Share on other sites

I just tried it, only offset reports 1820. This gives nine detentes, which is inconsistent with the five positions I observe when running the flaps manually. Any suggestions?

You can read the Flaps details on the Flaps calibration page of FSUIPC's options dialogue. Please check. What is there is what is supplied by FS. If the aircraft coding in an add-on does its own thing then there is no way for FSUIPC to get such information. You'll have to experiment.

Pete

Link to comment
Share on other sites

Serious question - why can you not just use the axis assignment from the A2A configuration tool for the P-51D to assign the flaps axis?

It will only be recognised by the P-51D and the default flaps axis isn't, so therefore you should be able to keep both assigned to the same axis without causing any clashes.

I haven't been able test this, unfortunately, as I didn't have time last night, but will be able to do so later if necessary.

Ian P.

Link to comment
Share on other sites

The reason is that that the panel I am designing does not get recognised as an input device. It simply communicates with FSUIPC and LUA through a serial interface. It does therefore not present any axis to which I can map the flaps control.

On another note, from the options dialogue it appears that FSUIPC knows nothing about the flaps of the Mustang. I just have to learn to live with it, I guess ;)

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.