John Dowson Posted August 18, 2021 Report Posted August 18, 2021 2 hours ago, Hano said: I tried all these steps but nevertheless I don't get it work. What exactly isn't working? The script log shows that the lua is running ok. Maybe you can try listing the lvar values and checking the value of the lvar L:A32NX_PARK_BRAKE_LEVER_POS Does it change value when you apply/release the parking brake?
IanAbel Posted August 18, 2021 Report Posted August 18, 2021 On 6/15/2021 at 1:23 AM, Chad P said: with the last updates of the FBW A320 Developer Version fsuipc is unable to read parking break state, so for all virtual airlines or tools using this state to start tracking the flight, flying the a320 is impossible. Chad, not sure if you're involved in the tracking tool you use/in question, but you may want to pass this on to whomever is; I'm the author of the BAVirtual ACARS program, in the past with several platforms/developer aircraft parking brake and other items have become "questionably reported". To that end I have for a while now adopted the following for start/end of flight recognition; Start - Either, parking brake state, OR ground speed non-zero, OR an engine start End - zero ground speed and engines off. BAVirtual ACARS works fine with the MSFS/FBW as a result of this, in spite of such issues. Hope this helps.
buick552 Posted August 22, 2021 Report Posted August 22, 2021 On 6/23/2021 at 5:07 PM, John Dowson said: Sorry, I was mistaken - you don't need to add the lvar to an offset to use the lua script. Just download the latest version (attached), and place it in your FSUIPC7 installation folder. Then add an entry to your FSUIPC7.ini [Auto] section, or, preferably, your [Auto.xxxx] section (where xxxx is the profile name for your A320. If you don't know how to do that, check the Advanced User Guide, section Automatic running of Macros and Lua plugins (P36). A320ParkBrake.luaUnavailable Well, this LUA is unavailable to download. Can you send it again please?
John Dowson Posted August 22, 2021 Report Posted August 22, 2021 7 minutes ago, buick552 said: Well, this LUA is unavailable to download. Can you send it again please? A320ParkBrake.lua 1
buick552 Posted August 22, 2021 Report Posted August 22, 2021 Since the LUA John Dowson previously added is unavailable, i tried to do smt by myself.. only to fail.. what's wrong with this code gentlemen? local pBrakePosition = 0 while true do pBrakePosition = ipc.readLvar("L:A32NX_PARK_BRAKE_LEVER_POS"); if pBrakePosition >= 1 then pBrakePosition = 32767 end ipc.writeUW(0x0024, pBrakePosition) ipc.sleep(1000) end
John Dowson Posted August 22, 2021 Report Posted August 22, 2021 1 hour ago, buick552 said: Since the LUA John Dowson previously added is unavailable, i tried to do smt by myself.. only to fail.. what's wrong with this code gentlemen? local pBrakePosition = 0 while true do pBrakePosition = ipc.readLvar("L:A32NX_PARK_BRAKE_LEVER_POS"); if pBrakePosition >= 1 then pBrakePosition = 32767 end ipc.writeUW(0x0024, pBrakePosition) ipc.sleep(1000) end You need to understand how the spoof offset at 0x0024 works. Please see the provided documentation. Here is the code in the script I provided: local spoofOffset = 0x0BC8 -- Parking Brake offset, unsigned word (2 bytes) local pBrakePosition = 0 -- Loop forever while true do -- Get value of the lvar A32NX_PARK_BRAKE_LEVER_POS pBrakePosition = ipc.readLvar("L:A32NX_PARK_BRAKE_LEVER_POS") if pBrakePosition == 1 then pBrakePosition = 32767 end -- and write it via 0024 as overrides to those being read ipc.writeStruct(0x0024, "1UW", spoofOffset, "1UW", 2, "1UW", pBrakePosition) -- Sleep for 100 mSecs so the update gets done roughly 10 times per second ipc.sleep(100) end John
CXA001 Posted January 19, 2022 Report Posted January 19, 2022 I have been through this thread as we have pilots who would like to be able to log flights with the FBW A320 but are encountering the same issues regarding the parking brake as other Acars systems. I like the idea of having a lua file that those that wish to fly this aircraft can install in order to log flights with this aircraft without having to modify the code of our Acars system as this issue only seems to be with this particular aircraft and only 10% of our pilots actually fly with MSFS 2020. I have tried several of the lua files in this thread and it doesn't seem to work and my knowledge of lua is non existent. Our acars software uses the following offset: Offset<short> FSUIPCParkingBrake = new Offset<short>("FSUIPCParkingBrake", 0x0BC8); The logic to start the flight logs is as follows: if (Convert.ToString(FSUIPCParkingBrake.Value) == "0") ...display warning else ... start flight log How would I (if possible) format the lua script to take the value of A32NX_PARK_BRAKE_LEVER_POS and write it to offset 0x0BC8 or do I absolutely have to change my code in our Acars system? Thanks in advance, Marc
John Dowson Posted January 20, 2022 Report Posted January 20, 2022 10 hours ago, CXA001 said: I have tried several of the lua files in this thread and it doesn't seem to work and my knowledge of lua is non existent. Just use the latest lua, or create a lua file with the contents in my last post. 10 hours ago, CXA001 said: How would I (if possible) format the lua script to take the value of A32NX_PARK_BRAKE_LEVER_POS and write it to offset 0x0BC8 or do I absolutely have to change my code in our Acars system? This is basically what that script does, although the value is not written but 'spoofed', so any external program that reads the offset will read the spoofed value. Is the lua actually running? i.e. have you added it to the [Auto] (or profile [Auto.xxx]) section of your FSUIPC7.ini file? Have you installed the FSUIPC WASM module and enabled it? Otherwise, try enabling lua debug logging and generate a log file where you load the aircraft, apply and release the parking brake, and then exit. Do not start a new log - I need to see the full log file. Note also that lua is only available to registered/licensed copies of FSUIPC.
CXA001 Posted January 20, 2022 Report Posted January 20, 2022 Hi John, As always, thanks for the quick reply. We will do some more testing and will advise. I will also have to check to see if those that were doing some testing with me are using registered licenses of FSUIPC. I do have registered versions of WideFS and FSUIPC, so I should be able to look into this further. Regards, Marc
CXA001 Posted January 22, 2022 Report Posted January 22, 2022 Hi John, LUA is installed and I enabled a separate log for it. I loaded up the default FBW A320 Neo and released and enabled the parking brake but the spoofed value is always 0 for offset 0x0BC8. Log is attached. Marc A320ParkBrake.log
John Dowson Posted January 22, 2022 Report Posted January 22, 2022 What do you mean by the 'default' FBW - are you using the stable or development version? If the former, try the latter. This was previously only tested on the dev version. The MobiFlight hubhop preset list (https://hubhop.mobiflight.com/#/list) lists this lvar as belonging to the A320-SDKm so not sure which versions it is available in (but I would have thought both, but maybe this is not the case). Your log shows that the lvar read is not changing value. Can you try listing the available lvars, using the Add-Ons->WASM->List Lvars menu item. Can you see the lvar there? If so, try changing setting and clearing the parking break to see if this changes value. Check in both the stable and dev versions. John
CXA001 Posted January 22, 2022 Report Posted January 22, 2022 Hi John, By default, I was referring to the latest stable version with no other add-ons or mods. I will install the developer version and run the tests on both. Regards, Marc
John Dowson Posted January 22, 2022 Report Posted January 22, 2022 1 hour ago, CXA001 said: By default, I was referring to the latest stable version with no other add-ons or mods. I will install the developer version and run the tests on both. As I said, check the lvar is available in whatever version you are using, and check that the lvar value changes when the parking brake is engaged or disengaged. The script depends on that lvar being available and working. I haven't checked this for many months, things may have changed. I will also take a look when I get a chanve. John
CXA001 Posted January 23, 2022 Report Posted January 23, 2022 I still could not get it to work with the development version. Switch back to the stable version and still a no go. I completely removed FSUIPC and did a fresh install, enabled WASM like I did before and success. Not exactly sure why it did not work the first time. A clean install of FSUIPC seems to have done the trick. Thanks for the help! Marc
John Dowson Posted January 23, 2022 Report Posted January 23, 2022 Well, as I said, you should just gave checked if the lvar was available and that its value changes as appropriate. Please remember this as it is always the first thing to try when using lvars. John
CXA001 Posted January 23, 2022 Report Posted January 23, 2022 Will do John. Again, thanks for your help! Marc
Scotfleiger Posted January 24, 2022 Report Posted January 24, 2022 @CXA001 The Lvar A32NX_PARK_BRAKE_LEVER_POS can be used to operate the Park Brake handle - set to 0 for off, 1 for on. This is the LUA code I am using in LINDA: -- $ Park Brake function A32nx_PARK_BRAKE_on() ipc.writeLvar("L:A32NX_PARK_BRAKE_LEVER_POS", 1) end function A32nx_PARK_BRAKE_off() ipc.writeLvar("L:A32NX_PARK_BRAKE_LEVER_POS", 0) end function A32nx_PARK_BRAKE_toggle() if ipc.readLvar("L:A32NX_PARK_BRAKE_LEVER_POS") > 0 then A32nx_PARK_BRAKE_off() else A32nx_PARK_BRAKE_on() end end
John Dowson Posted January 24, 2022 Report Posted January 24, 2022 27 minutes ago, Scotfleiger said: The Lvar A32NX_PARK_BRAKE_LEVER_POS can be used to operate the Park Brake handle - set to 0 for off, 1 for on. This is the LUA code I am using in LINDA: Yes, but that was not the issue. It seems quite a few ACARS systems use the FSUIPC offset 0x0BC8 to determine the state if the parking brake. The OP wants the value of the lvar L:A32NX_PARK_BRAKE_LEVER_POS to be used instead, so I provided a lua script to spoof offset 0x0BC8 with the value of that lvar, i.e when that offset is read from an external app, it is actually reading the value of the lvar. The script wasn't working initially, not sure why, but the OP has resolved the issue and it is now working. John
CXA001 Posted January 30, 2022 Report Posted January 30, 2022 I am not sure why it was not working either, but it is working now and we have some happy pilots that can log flights with the FBW A320. Regards, Marc
Chad P Posted April 29, 2022 Author Report Posted April 29, 2022 I am using this script with sucsess in the FBW A320, but all other aircraft have problems getting the parking brake when this script is running Is there a solution that this script is only activated with the FBW Mod or we can edit the script that other ac are not affected?
John Dowson Posted April 29, 2022 Report Posted April 29, 2022 2 hours ago, Chad P said: Is there a solution that this script is only activated with the FBW Mod or we can edit the script that other ac are not affected? Just tun the script only for the FBW A320. Are you using profiles? If not, you should, as this is the mechanism to have different assignments for different aircraft. You need to auto-start the lua from the profile [Auto.xxx] section (where xxx is the profile name) rather than the [Auto] section that will be used for all aircraft. If you do nor know what profiles are, please read the user manuals... John
scorpi1987 Posted April 15 Report Posted April 15 Hi iam planning to add an indicator light on my EFB Software to read out the Parking Brake status... on mobiflight i do it with the (A:BRAKE PARKING INDICATOR,Bool) LVAR . is it possible to add them in the next update ? Because some Jeehell FMGS users want this to use my Mod 🙂
John Dowson Posted April 16 Report Posted April 16 21 hours ago, scorpi1987 said: i do it with the (A:BRAKE PARKING INDICATOR,Bool) LVAR . That is an A-var (a simvar) not an lvar. Why not just use offset 0x0BC8 (A:BRAKE PARKING POSITION)? I have added A:BRAKE PARKING INDICATOR in the attached version at offset 0x028D (1 byte). However, in the FBW A320 I do not see this offset change when I set the parking brake, but offset 0x0BC8 does. Are you sure the FBW A320 uses this simvar? John FSUIPC7.exe
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