sxa1376 Posted March 8, 2015 Report Posted March 8, 2015 Dear guys, This request is for everyone that it can helps. I need to create a simple lua file. My intention is because I am building a custom a320 fcu (autopilot) I need a lua file to check if autopilot is engaged and if so also the auto rudder to be engaged as well and if the autopilot disengages the auto rudder also to be disengaged. The autopilot master consists of two switches : master one (for captain) and master two for (co-pilot). In normal flight either one or the other are switched on. It depends of which one (captain or copilot is flying the aircraft) and then for ils landings both autopilots are on. The thing is that when any or both autopilots are on the auto rudder must be on and when autopilots are off then the auto rudder must be off . Bellow are the three buttons from fsuipc.cfg file that they are needed. Auto pilot master switches : [buttons]PollInterval=25ButtonRepeat=20,10 . . . . . . 15=PA,17,C2998,32 (Autopilot captain engager offset)16=PA,14,C2998,33 (Autopilot copilot engager offset) . . . . . . 90=PG,11,C65951,0 (Auto rudder offset) . . . . . I would be very grateful guys if anyone from you do this for me because to be honest I tried to read the documents and to do it by my self but I can not understand nothing about lua files. Many thanks in advance. 1
Donovan Posted March 8, 2015 Report Posted March 8, 2015 You can certainly write a Lua Script for this, but you can also use the Conditional Button Programming as described in the FSUIPC for Advanced Users PDF. Here is an (untested) approach for programming the Buttons. Definitions ("=>" denotes action to be taken when button switched position) AP_1 = Pilot AP master switch (Joystick A, Button 17 = A,17) AP_2 = CoPilot AP master switch (Joystick A, Button 14 = A,14) AR = Autorudder Toggle ON/OFF switch (Joystick G, Button 11) Assumptions 1. That the PM Offsets you have listed for the Pilot and CoPilot AutoPilot engage toggles the respective AP functions on/off (i.e. doesn't require a write to a separate offset, or a different <,parameter> to turn AP function off) 2. That the AR Switch is overridden by the AP switch positions (i.e. you cannot turn AutoRudder off if either AP_1 or AP_2 is ON, and you cannot turn AutoRudder ON if both AP swithes are OFF) -- If this is the case, I am not sure why you even have the physical button programmed on Joystick G, Button 11, as it would not be independently operative) Logic 1. AP_1 ON => if AP_2 OFF => pilot AP ON + Toggle AutoRudder ON if AP_2 ON => pilot AP ON + do NOT toggle AutoRudder AP_1 OFF => if AP_2 OFF => pilot AP OFF + Toggle AutoRudder OFF if AP_2 ON => pilot AP OFF + do NOT toggle AutoRudder 2. AP_2 ON => if AP_1 OFF => co-pilot AP ON + Toggle Autorudder ON if AP_1 ON => co-pilot AP ON + Do NOT Toggle AutoRudder AP_2 OFF => if AP_1 ON => co-pilot AP OFF + Do NOT Toggle Autorudder if AP_1 OFF => co-pilot AP OFF = Toggle AutoRudder OFFResult 1. If either AP_1 or AP_2 or Both is/are on, AR is ON 3. If Both AP are OFF => AP OFF and AutoRudder OFF Edit FSUIPC.INI [buttons] Section: ;line numbers are arbitrary adjust to suit own needs [buttons]PollInterval=25ButtonRepeat=20,10InitialButton=A,14,A,17,G,11 ;(Optional) intializes these buttons/flags in 'off' state 15=CP(F-A,17)(-A,14)A,17,C2998,32 ;if AP_1 was OFF, and AP-2 is OFF => turn AP_1 ON then:16=CU(F-A,17)(-A,14)A,17,C65951,0 ;toggles AutoRudder (AR) ON when button released 17=CP(F-A,17)(+A,14)A,17,C2998,32 ;if AP_1 was off, and AP_2 is ON, then toggles AP_1 ON 18=CP(F+A,17)(-A,14)A,17,C2998,32 ;checks AP_1 was ON and AP_2 is OFF, toggle AP_1 then:19=CU(F+A,17)(-A,14)A,17,C65951,0 ;toggles AR OFF when button released 20=CP(F+A,17)(+A,14)A,17,C2998,32 ;tests if AP_1 was on and AP_2 is on, then toggles AP_1 OFF 21=CP(F-A,14)(-A,17)A,14,C2998,33 ;if AP_2 was off and AP_1 is off, then toggles AP_2 ON then:22=CU(F-A,14)(-A,17)A,14,C65951,0 ;toggles AR ON when released 23=CP(F-A,14)(+A,17)A,14,C2998,33 ;if AP_2 was off and AP_1 is on, then toggles AP_2 ON 24=CP(F+A,14)(+A,17)A,14,C2998,33 ;if AP_2 was on and AP_1 is on, then toggles AP_2 OFF 25=CP(F+A,14)(-A,17)A,14,C2998,33 ;if AP_2 was on and AP_1 is off, then toggles AP_2 OFF then:26=CU(F+A,14)(-A,17)A,14,,C65951,0 ;toggles AR OFF when released Don
sxa1376 Posted March 10, 2015 Author Report Posted March 10, 2015 Dear Donovan, It worked! Many many many thanks thanks thanks brother!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now