Jump to content
The simFlight Network Forums

Dynamic Axis assignment


Recommended Posts

2 hours ago, cellular55 said:

For example: is it possible to have an axis assigned to the steering on the ground and to ailerons when airborne?

You'd need to do it via a Lua plug-in.  It would need to be a plug-in running all the time (eg loaded by an [Auto] section entry, then assign using this facility:

LuaValue <plugin name>

to set the ipcPARAM variable to the given parameter, or the axis value when so assigned.

The plugin would use event.param to react to an axis change and call a function which checked on ground or not (an offset) to determine which axis control to use.

The only drawback is that you wouldn't be able to use FSUIPC's calibration.

Simpler really to assign the axis to both controls -- steering does nothing in the air, and ailerons may not do too much damage on the ground. And you'd be able to calibrate them differently -- maybe steering only using a small part of the axis so as not to disturb the ailerons too much.

Pete

 

Link to comment
Share on other sites

6 hours ago, Pete Dowson said:

The only drawback is that you wouldn't be able to use FSUIPC's calibration.

There are offsets that allow you to disconnect the main FSUIPC axis assignments. It should be possible to assign the axis to the aileron control in FSUIPC and then, while on ground, disconnect and redirect it to the STEERING_SET control instead.

STEERING_SET = 66818

function onAileronAxis(_, value)
  ipc.control(STEERING_SET, value)
end

function disconnectAileronAxis()
  ipc.setbitsUB(0x310A, 2)
end

function reconnectAileronAxis()
  ipc.clearbitsUB(0x310A, 2)
end

function onGroundFlag(value)
  local onGround = value == 1
  if onGround then
    event.timer(5000, "disconnectAileronAxis")
    event.offset(0x3328, "SW", "onAileronAxis")
  else
    event.cancel("disconnectAileronAxis")
    event.cancel("onAileronAxis")
    reconnectAileronAxis()
  end
end

event.offset(0x0366, "UB", "onGroundFlag")

 

Link to comment
Share on other sites

Hi,

I think I'm misisng something.

This is what I wrote following @adrem suggestions, but it seems to not properly run:

STEERING_SET = 66818

function onRudderAxis(_, value)
  ipc.control(STEERING_SET, value)
end

function disconnectRudderAxis()
  ipc.setbitsUB(0x310A,4)
end

function reconnectRudderAxis()
  ipc.clearbitsUB(0x310A, 4)
end

function onGroundFlag(value)
  local onGround = value == 1
  if onGround then
    event.timer(5000, "disconnectRudderAxis")
    event.offset(0x332C, "SW", "onRudderAxis")
  else
    event.cancel("disconnectRudderAxis")
    event.cancel("onRudderAxis")
    reconnectRudderAxis()
  end
end

event.offset(0x0366, "UB", "onGroundFlag")

Thank and KR

Joe

Link to comment
Share on other sites

1 hour ago, cellular55 said:

I think I'm misisng something.

This is what I wrote following @adrem suggestions, but it seems to not properly run:

What is it doing, then? Have you tried the Lua logging option to see what it is doing.

I thought it was Aileron and Steering you wanted to combine on the same axis? If it is just steering and rudder, then why bother? If you assign to both and calibrate both then FSUIPC will gradually change from steering to rudder as the ground speed increases.

Pete

 

Link to comment
Share on other sites

Hi Pete,

yes.. you are right.. I have now assigned rudder and steering to same axis and things are fine.

I was thinking that doing that i could find troubles at high speed during takeoff anf landing, but is not the case

Thanks also to @adrem: for sure I will test that for other stuffs I have in mind.

Thanks again and KR

Joe

Link to comment
Share on other sites

21 minutes ago, cellular55 said:

the only strange problem is that the steering seems now to act in 'reverse' mode.

That can be fixed by reversing it in the code: ipc.control(STEERING_SET, -value)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.