Jump to content
The simFlight Network Forums

FSL A320 brakes


Recommended Posts

Hello,

I created an axis assignment for the FSLA320 that allows me to utilize the joystick to apply the brakes, using the LeftBrake and RightBrake actions on the same Y axis. Works quite well as I can slowly push the axis forward to apply gradual braking instead of tapping the . key repeatedly which doesn't work very well for me.

However, since this axis is also assigned to the Elevator (and Slew Ahead), this means that when I tip the nose forward in the air, the brakes are also applied. Not the end of the world as the brakes don't do anything in the air, but my question is: is there a way in FSUIPC to conditionally apply the brakes function when on the ground only, using the above axis setup? Or is there some other way to achieve what I wanted, this was the only way I could find to achieve what I wanted? I don't have separate brake pedals, just a joystick and a keyboard.

Thanks

Jonathan

Link to comment
Share on other sites

4 hours ago, jonathanfe said:

but my question is: is there a way in FSUIPC to conditionally apply the brakes function when on the ground only, using the above axis setup?

You can do what you want, in the way you suggest, but only by using a Lua plug-in. You'd need to actually send the brake controls (the ipc.control function) from the plug-in after checking, by reading the "on ground state offset (by the ipc.readUB function) and checking you are on the ground. You'd assign the Lua plug-in for the Y axis instead of the brake. You wouldn't be able to select the elevator control in the "Direct to FSUIPC" list, but assigning to the normal FS control will be fine in any case.

Pete

 

Link to comment
Share on other sites

Thanks Pete.

Actually maybe I could ask for some more help (anyone?)?

I wrote the following which does what I want (apply brakes when on ground). I can see the brakes values increasing by watching the offsets outputted to the screen display. I set up the axis assignment to call my lua script when a range is entered (8000 to 16383 i.e. when I push the stick forward), and repeat whilst in range.  This works sort of OK for the default Trike, but on loading the FSL A320 the values stop updating which means the brakes don't get pressed. I tried it by setting controls, using the default keypress (.) and setting the toe brakes offsets directly to emulate the keypress.  The only way I can get FSLA320 brakes to respond is to use the offset method. However this way is like bashing the . key, and setting the offset value to 200 slams the brakes on - is there a different way to code this to more smoothly apply the brakes perhaps?

 

function press_brake (offset, value)
-- function decides that if the value of offset is 1, then send brake controls
    if value == 1 then
-- send left and right brake controls
--        ipc.control(65720)
--        ipc.control(65721)
--        ipc.keypressplus(190,8,1)
        ipc.writeUB("0C01",150)
        ipc.writeUB("0C00",150)
    end
end

-- read the offset value 0366 which is aircraft on ground offset and pass to function
event.offset("0366", "UB", "press_brake")

 

Thanks

Link to comment
Share on other sites

7 hours ago, jonathanfe said:

s there a different way to code this to more smoothly apply the brakes perhaps?

First off, your plug-in will still be running all the time after it is first invoked. The "event" system keeps it running, waiting for that even to occur again. That will happen any time the "on ground" flag changes.

You should, instead, simply assign the axis itself to the Lua plug-in (as well as to the elevator). There's no reason and little point in using the range assignments on the right-hand side. But you would have to assign the elevator using the FS control method, not "direct to FSUIPC". But that should be okay.

Next, you want to be sending a value based on the axis value rather than just using the Brakes ON/OFF system. That's why the value is provided. Don't use any "event". Just use ipc.readUB to read offset 0366 to decide what to do, then use the Axis controls (not "Brakes Left/Right", but the ones you'd assign to real toe brakes).

Since you only want the brakes to come on when you push the stick forward a ways, test also that the "value" is over 8000, else do nothing.

In all the two ipc.control calls you do, use the relevant Axis control numbers and put a number derived from the "value" from your joystick as the parameter.  For a "value" of 8192 to 16383, say, just use 2*(value - 8192). That will give the correct full range for the brake axes, assuming you only do this when value >= 8192 of course.

Pete

 

 

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.