Search the Community
Showing results for tags 'registered fsuipc'.
Found 1 result
Here is a Lua file that progressively apply and/or disengage brakes, adjustable in both directions, for those who only have a button for brakes. [INSTALLATION] FS closed Copy the complete code block below, paste it into an empty .txt file & rename it Smooth_Brake.Lua Place the above file in the FS/Modules folder Add the following to the [Auto] section of the FSUIPC(4).ini file - X=Lua Smooth_Brake - Where X is the next available number in the [Auto] section. (pg. 42 - FSUIPC4 for Advanced Users.pdf) Comment out ( ; ) or remove the original brake button listing in the [buttons] section. Start FS Make sure the button is not programmed through the FS assignments dialog. For a simple, non-complex assignment to the joystick button see the picture below. For a complex assignment see pg. 22 - FSUIPC4 for Advanced Users.pdf - Using something similar to this for a button press - xx=CP(-0,11)0,0,CL6:S,211 and this for release - xx=CU(-0,11)0,0,CL6:C,211. Where 6 is the numbered lua under the [LuaFiles] section of FSUIPC(4).ini in my case as an example. Use the FSUIPC facility, "Reload Buttons", from the user interface in the Buttons tab to confirm assignment. Adjust user settings to ones own liking. Assign a keyboard key to reload the file using Lua Smooth Brake as the control sent to use for reloading tuning modifications. One can use the Logging facilities in FSUIPC, using the right hand side of the dialog (FSX + only), using 0BC4, 0BC6 & 0BC8 with a type of U16, display to FS Window, to help in adjusting user settings. The above settings result in this - 1=P0,0,CL6:S,211 2=U0,0,CL6:C,211 [USAGE] Basically all this does is gradually increase (depending on settings) the brake strength as the assigned brake button is pushed. It also works in reverse, on brake disengagement. One could, for instance press the brake button for only 1 second and after that toggle the brakes on & off at a repetitive rate to keep, lets say, ~ 50% brake strength. It's much better than full on or full off. The settings as given below give around a 2.75 second span between brakes off to full brake strength. Smooth_Brake.Lua - --------------------- USER SETTINGS rate_on = 300 -- RATE AT WHICH BRAKES ARE APPLIED minimum = 3500 -- MINIMUM BRAKES ON FIRST APPLY = REQUIRED PERCENT * 16384 rate_off = 300 -- RATE AT WHICH BRAKES ARE RELEASED dis_pbrake = 1 -- DISENGAGE PARKING BRAKE ON BRAKE APPLICATION? REQUIRES A REAPPLY FOR BRAKE ACTIVATION! diff_brake_override = 0 -- !!!! GIVES AN ALTERNATE DIFFERENTIAL BRAKE AXIS PRIORITY OVER BRAKES -- EXAMPLE - THE "T_FLIGHT HOTAS" ALTERNATE AXIS ON THROTTLE SECTION -- SEE PG.1 "FSUIPC LUA LIBRARY" - "n = ipc.axis(joynum, "axis")" FOR MORE INFORMATION. --------------------- END USER SETTINGS function stop() brake = ipc.readUW(0x0BC4) -- Get Parking Brakes If Button Pressed And Parking Brake Disengage Is Active if ipc.testflag(211) == true and dis_pbrake == 1 then p_brake = ipc.readUW(0x0BC8) -- Disengage Parking Brakes If Set if p_brake == 32767 then ipc.control(65752, 0) end end -- Brakes On while brake < 16383 and ipc.testflag(211) == true do -- Differential Braking Override if diff_brake_override == 1 then -- REQUIRES CUSTOM ATTRIBUTES FOR SPECIFIC HARDWARE special = ipc.axis(0,"S") if special > 1000 or special < -1000 then brake = 0 break end end brake = math.min(16384, brake + rate_on) brake = math.max(minimum, brake) brake_shift = logic.Shl(brake, 16) + brake ipc.writeUD(0x0BC4, brake_shift) end -- Brakes Off while brake > 0 and ipc.testflag(211) == false do -- Differential Braking Override if diff_brake_override == 1 then -- REQUIRES CUSTOM ATTRIBUTES FOR SPECIFIC HARDWARE special = ipc.axis(0,"S") if special > 1000 or special < -1000 then brake = 0 break end end brake = brake - rate_off brake = math.max(0, brake) brake_shift = logic.Shl(brake, 16) + brake ipc.writeUD(0x0BC4, brake_shift) end end event.flag(211, "stop")