Using LINDA to Interface with the MJC8400
Hi all,
I wanted to take a moment to give back a little to this community. I'm currently building my own Q400 cockpit and while I'm certainly not an expert in building, I'm definitely not an expert in programming - but I'd like to share a couple things that I've learned about interfacing with the MJC84. I wish this information had been handy when I was building so I'd like to put it out there for others who may be contemplating building a Q400 sim.
I won't go into too much discussion on how to use the program, but I'm using LINDA to program my inputs in conjunction with Leo Bodnar BU0836X boards and BBI-64 Boards. Just a quick note - you can use LINDA to interface your joystick/yoke/throttle quadrant buttons to the MJC84.
First - download LINDA: https://www.avsim.com/forums/topic/573578-linda-326-p3dv5fsuipc6-compatible-17-aug-2020/
Next - download and install the MJC84 LINDA profile: https://www.avsim.com/forums/topic/406320-majestic-dash-8-q-400-module-26/
This profile was last updated in 2018 and includes most but definitely not all inputs into the Q400. I'd assume this project is mostly dead, which is a shame, but it still works great in LINDA.
For me, I recently completed building a UNS-1 to go along with my Q400 home cockpit: https://imgur.com/P6DDWVx
Interfacing posed a problem because in the LINDA profile, there were no inputs for the FMS keys written so I had to figure out how to program them. I read and re-read the documentation provided by Majestic and I just couldn't come up with a good way to interface the FMS buttons - just not a programmer and don't have a programmers brain. After exchanging a few emails with Support, I was reminded that I could interface the FMS buttons through Lvars, which is what LINDA uses. So I went through the MJC84 code for LINDA and was able to reverse-engineer inputs. This should work for every input listed in VariablesMap.xlsx in the mjc8q400/doc/ExtInterfaces folder.
So, to program the "ON/OFF/DIM" button in LINDA, here's what we need to do:
First, open LINDA, select the Majestic Dash 8 Q-400 profile at the top. Hit edit, then in the new window that pops up hit "Edit User" at the bottom. This file allows you to add your own inputs without disturbing the main profile.
We're going to be working mainly with this phrase:
function name_your_input_here ()
MJCD8_Write(signalsent, resultingCRC)
end
So, first name whatever button you're going to trying to program. Can be anything, but it's helpful to name it after the button your programming. In our case, lets name it FMS_KEY_ONOFF.
Now, go to VariablesMap.xlsx found in mjc8q400/doc/ExtInterfaces folder. Go to the FMC tab at the bottom. The second input down is listed as:
FMC_->FMC[0].eventState.key_press_input
In the description for that variable, you'll see the list of each key and it's corresponding signal for that key:
FMC_KEY_ONOFF 242
For the ON/OFF/DIM switch, it's 242.
Last step is getting the resulting CRC.
Go to mjc8q400\doc\ExtInterfaces\XML and find IntVarCRCGen.exe
In the text field, we're going to paste the variable name, in this case it's FMC_->FMC[0].eventState.key_press_input and get our CRC, which is 79415
So our code to write into LINDA would be
function FMS_KEY_ONOFF ()
MJCD8_Write(242, 79415)
end
Similarly, if you wanted to program the TCS Button this way it would look like this:
function TCS_Button ()
MJCD8_Write(1, 29521)
end
The test position on the Anti-Skid switch:
function GL_AntiSkid_TEST ()
MJCD8_Write(2, 96582)
end
And so on...
Once your input is programmed, you can go into the joysticks section of LINDA and start assigning these inputs to buttons on your joystick. I have my entire overhead panel, pedestal panel and now my FMS interfaced through LINDA and it's working great. It's a fantastic method until MJC's COCKPIT edition comes out and lets us program these buttons through their native software.
This post may be obvious and a waste of time to some people, but I certainly didn't understand how to do it so if I help just one person, it'll be worth it.
Pics of my setup just for fun:
Next up I'm working on the ARCDU, the WX Radar panel, the AHRS slew panel and starting to introduce backlighting into my build.
Comments
Thank you so much for this very helpful post
Thanks to your post and another one by aua668 (Reinhard) I have succeeded in assigning the ARCDU sidekeys to buttons via a Lua plug-in. At least I understand that part of the process. Now I would also like to assign the ARCDU tuning rotary knobs to buttons (one increase and one decrease each for the inner and outer knobs). Unfortunately I've been unable to figure out how to do that. Could you point me in the right direction if it's not too much trouble ? Thanks in advance for any help.
Love your panels BTW, fantastic job you've done !
Cheers,
Emile.
Disregard - I've figured it out
Could you share your process on getting the ARCDU rotary knobs to function via LINDA/LUA? The ARCDU is next on my list to complete..
Sure thing! Here is the section in my DASH8 Lua plug-in that deals with the ARCDU tune knobs (and sorry for the delayed reply). Hopefully the function names are self-explanatory:
-- ### ARCDU tune knobs section ###
function ARCDU_TuneKnob_Outer_Decrease()
ipc.writeLvar("MJC_VAR_WRITE_VALUE", -1)
ipc.writeLvar("MJC_VAR_WRITE_CODE", 68036)
end
event.flag(78, "ARCDU_TuneKnob_Outer_Decrease")
function ARCDU_TuneKnob_Outer_Increase()
ipc.writeLvar("MJC_VAR_WRITE_VALUE", 1)
ipc.writeLvar("MJC_VAR_WRITE_CODE", 68036)
end
event.flag(79, "ARCDU_TuneKnob_Outer_Increase")
function ARCDU_TuneKnob_Inner_Decrease()
ipc.writeLvar("MJC_VAR_WRITE_VALUE", -1)
ipc.writeLvar("MJC_VAR_WRITE_CODE", 68519)
end
event.flag(80, "ARCDU_TuneKnob_Inner_Decrease")
function ARCDU_TuneKnob_Inner_Increase()
ipc.writeLvar("MJC_VAR_WRITE_VALUE", 1)
ipc.writeLvar("MJC_VAR_WRITE_CODE", 68519)
end
event.flag(81, "ARCDU_TuneKnob_Inner_Increase")
-- ### End Section ###
I could have used the function MJCD8_Write (val, code) in LINDA's DASH8 actions.lua plug-in but it would not have saved much.
These ARCDU tune knob functions are called by event flags 78 to 81 respectively (using FSUIPC's LuaToggle function), which are assigned to a Leo Bodnar ELMA E37 dual concentric rotary encoder on my home-made "functional MCP". The box is built around a Hagstrom KE72 encoder that generates key commands, which LINDA cannot process, hence I had to use FSUIPC.
I think you are right that the actions.lua file for the DASH8 looks to be incomplete, but nevertheless it provided a lot of useful info. The corresponding files for the PMDG 737 NGXu and PMDG 777 were similarly helpful for creating my own Lua plug-ins.
Hope this helps.
Cheers,
Emile.
Cool! Thank you so much for taking the time to type that out and share, Emile!