Jump to content
The simFlight Network Forums

Milviz PC-6 Tailwheel lock


Andre92

Recommended Posts

Hello,

 

I am trying to assign a button to the Tailwheel lock for the Milviz PC-6. On the Hubhop site of Mobiflight i found the following code:

(A:TAILWHEEL LOCK ON, Bool) 0 == if{(>K:TOGGLE_TAILWHEEL_LOCK)}

Can i use this for FSUIPC as well? If so, how?

Sorry for the noob question, but i'm more and more confused with MSFS way of implementing events A: K: L: H:....? 🙃

 

Regards,
André

Link to comment
Share on other sites

6 minutes ago, Andre92 said:

I am trying to assign a button to the Tailwheel lock for the Milviz PC-6. On the Hubhop site of Mobiflight i found the following code:

(A:TAILWHEEL LOCK ON, Bool) 0 == if{(>K:TOGGLE_TAILWHEEL_LOCK)}

Can i use this for FSUIPC as well? If so, how?

Yes - a 'K' type variable is the same as an FSUIPC control, so just assign your button to the control (when you select 'select for FS control') Toggle Tailwheel Lock.
'A' type variables are simvars and are held in fsuipc offsets (that is in offset 0x2A90). The conditional check 'A:TAILWHEEL LOCK ON, Bool) 0 == if' is only checking the lock is off before sending the control ('(>K:TOGGLE_TAILWHEEL_LOCK)') , so its the code to turn on the wheel lock. You don't really need that if assigning to a button. If assigning to a switch, with one button for off and another for on, then you would use an offset condition (see Advanced User Guide) to only send the control if the actual state of the wheel lock (as reported in that offset) was in the correct position (value 1 or 0, depending if the assignment is for on or off).

The latest version of FSUIPC, v7.2.16, released a few hours ago, also has assignments to MobiFlight (as well as user-provided) presets available for direct assignment in the menus. Please download and try that. The MF presets should be available automatically, but please check the Advanced User guide for details.

John 

Link to comment
Share on other sites

That worked great! Thank you John, also for taking the time to write such a detailed answer.

I've made two small lua files to read the offset and turn the tailwheel on/off depending on the state. Works like a charm.

They are attached here, in case someone else wants to use them. (Place them in the fsuipc directory and assign them through the FSUIPC Interface)

Andre

 

MilvizPC6_Tailwheel.zip

Edited by Andre92
Changed the ipcwrite to unsigned double
Link to comment
Share on other sites

Hi Andre,

glad you got it working. One thing in your lua scripts - you are reading as an 'unsigned double', which is correct, but writing as a signed double. It will still work in this case, but better to also write as a signed double using the ipc.writeUD() function.

Also, you could have achieved the same using a standard control assignment with an offset condition. That would be slightly faster, as the lua method requires your script to be compiled each time before it is ran, but in this case it doesn't matter much.

John

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.