This are the (new) Support Forums for FSUIPC and related products.

These forums replace the old support forums which have been running for 20+ years. The old forums contain a wealth of information on all FSUIPC products, and are still available (until the end of the year) for read-only here.

At the moment these new forums are quite empty – I will be updating the FAQ section and copying across the User Contributions from the old forums in the next few months.

Please note that you will need to Register and Login to post for support, and also to download attachments. You can view these forums without registering.

Support is also available via Discord. Please use the following invite link to join the FSUIPC Discord server:
                           https://discord.gg/zjwUTrxmmE

Notifications
Clear all

"Smoother" braking when only a button is available

(@fsuipc-support)
Posts: 86
Moderator
Topic starter
 

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]

  1. FS closed
  2. Copy the complete code block below, paste it into an empty .txt file & rename it Smooth_Brake.Lua
  3. Place the above file in the FS/Modules folder
  4. 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)
  5. Comment out ( ; ) or remove the original brake button listing in the [buttons] section.  
  6. Start FS
  7. Make sure the button is not programmed through the FS assignments dialog.
  8. 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.
  9. 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.  
  10. 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. 

 

Smooth_Brake.jpg?dl=0

 

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

 

[Originally posted in old SimMarket support forums by spokes2112]


 
Posted : November 6, 2025 1:14 pm