JR111 Posted January 9, 2021 Report Share Posted January 9, 2021 Hi, I am trying to map the LNAV button from QW Avro RJ85. I am using P3D V4 and MobiFlight. The LNAV is not bound to an EventID or LVAR. The KEY_TOGGLE used to be AFTERBURNER2 but they removed it in an update due to a conflict. To trigger LNAV I have recorded a Mouse Macro and this works great. I have mapped it to a physical momentary button. When pushed and released, LNAV engages. When pushed and released for the 2nd time it disables it. Great! I would like to know if you can help me with a LUA file that MF will be able to read? In MF the LED for my button needs to read something, in this case it makes sense to read an offset (0x66E0). Is it possible to do something like this? Press physical button to engage LNAV 1) Execute the macro - "RJ85LNAVPress.MCRO" name of the macro inside is "press" 2) After that, write to offset 0x66D0 value of 1. Press physical button to disengage LNAV 1) Execute the macro - "RJ85LNAVPress.MCRO" name of the macro inside is "press" 2) After that, write to offset 0x66D0 value of 0. Here is my attempt so far: function LNAV_press () ipc.macro("RJ85LNAVPress:press") ipc.writeSW(0x66E0,1) end Thanks. Link to comment Share on other sites More sharing options...
John Dowson Posted January 9, 2021 Report Share Posted January 9, 2021 First, you are saying you are using offset 0x66D0, but your script is actually using 0x66E0 - just FYI. But the main problem is that you have wrapped the calls in a function - what is calling the function? If you are assigning the script to a button press, then you don't need the function, i.e. just ipc.macro("RJ85LNAVPress: press") ipc.writeSW(0x66E0,1) Otherwise, you could add an event.button() call to call the button on a button press - this would be more efficient as the script would not have to be recompiled each time it was executed. You are also setting this value as a signed word (SW). Thats fine, but if it is only holding 0/1, you could use an unsigned byte. John Link to comment Share on other sites More sharing options...
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