Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

is there the possibility to dynamically assign different controls to an axis?

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

Thanks and KR

Joe 

Posted
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

 

Posted
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")

 

Posted

Hi,

Thanks a lot for the replies!!!!!!!!!!

I will give it a try.

At the end I think that I will substitute the ailerons with the rudders, but I think that the concept should be the same.

Thanks again and KR

Joe

Posted

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

Posted
7 minutes ago, cellular55 said:

function onGroundFlag(value)

I forgot about the first parameter, it should be function onGroundFlag(_, value) instead.

Posted
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

 

Posted

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

Posted

Hi,

@adrem, I have tried again for curiosity your script with the last suggested modification and now the script does what it should do.. the only strange problem is that the steering seems now to act in 'reverse' mode.

Joe

Posted
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)

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.