Sign in to follow this  
Omais Ahmed

C/O Button or IAS Mach Button not Working

Recommended Posts

Hello everyone,

I'm using FSX SP2, also using standard aircraft not PMDG. C/O button is not changing air speed display value into decimal point when i assign AP_MACH_HOLD to a joystick's button. i don't know why?, otherwise it's working without joystick when I armed A/T First then enable Speed Hold and finally press C/O button. 

Please help me how do i resolve the problem? 

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

As asked over at the FSUIPC forum -
What stock aircraft are you actually referring to?
The 737, 747 & A321 all have different code for the C/O buttons.. It is not a built in command with FSX.
Examples -

B737-8

<Script>
  (M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:IAS Mach Pressed,bool) 
  (G:Var6) 1 + 2 % (&gt;G:Var6,number) } 
  (G:Var6,number) 0 == (A:autopilot mach hold, bool) 1 == and
  if{ (&gt;K:AP_PANEL_SPEED_HOLD) }
  els{ (G:Var6,number) 1 == (A:autopilot airspeed hold, bool) 1 == and if{ (&gt;K:AP_MACH_HOLD) } } 
  (M:Event) 'LeftRelease' scmp 0 == if{ 0 (&gt;L:IAS Mach Pressed,bool) }
</Script>

A321

<Script>
  (M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:IAS Mach Pressed,bool) 
  (G:Var6) 1 + 2 % (&gt;G:Var6,number) } 
  (M:Event) 'LeftRelease' scmp 0 == if{ 0 (&gt;L:IAS Mach Pressed,bool) }
</Script>

747-4

<!-- The 747 Doesn't have a C/O switch, it is automatically done when the individual speed hold type is engaged -->
<!-- SPEED HOLD -->
<Click>0 (>L:Mach-IAS select, bool) 0 (>K:AP_PANEL_SPEED_HOLD)</Click>
<!-- MACH HOLD -->
<Click>1 (>L:Mach-IAS select, bool) 0 (>K:AP_PANEL_MACH_HOLD)</Click>

Irregardless of which aircraft you use, a lua file along with FSUIPC will have to be used for joystick integration.
Not only that but the people over at MS used G:Vars for implementation in some aircraft for the autopilot -- BAD!, BAD!, MS!!
So... The autopilot will have to be modified to change G:Vars over to L:Vars so lua can be used.

Not a daunting task, just has to be done properly.

Share this post


Link to post
Share on other sites

Thanks spokes2112 for your response.

1 hour ago, spokes2112 said:

What stock aircraft are you actually referring to?

I'm using 737-800.

where I have to use above scripts?
please guide me.

Share this post


Link to post
Share on other sites

Multiple items need to be done.. The above scripts are just examples showing the custom code used by Microsoft for the AP buttons. None of them can be used for what needs to be done.

This is what needs to be done..
1) The autopilot.xml located in FSX\SimObjects\Airplanes\B737_800\panel\B737_800.cab will have to be modified to reassign some G:Vars to L:Vars.
2) A .lua file will have to be made to incorporate buttons to FSUIPC
3) The joystick buttons needed assigned to the lua within FSUIPC

If wanted I can do the work for you, it may take a day or 2.. please advise. 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you very much spokes2112 for response.

1 hour ago, spokes2112 said:

I can do the work for you, it may take a day or 2

I'll be glad if you do the work for me. thanks again.

Share this post


Link to post
Share on other sites

The code is done and fully tested..
Made 3 completely different versions, each one had their own little quirks, the last one fixing it all.
The hard part - writing the install instructions :laugh:
Should be done by the end of the day or earlier  ( US ), on it now with the morning coffee.

Stay tuned.

 

Share this post


Link to post
Share on other sites

Thank you spokes2112

12 minutes ago, spokes2112 said:

The code is done and fully tested..
Made 3 different versions, each one had their own little quirks, the last one fixing it all.

Wow! gud :)

15 minutes ago, spokes2112 said:

The hard part - writing the install instructions

May God make it easy for you. I'm waiting...May God bless you. Thanks again.

 

Share this post


Link to post
Share on other sites

Wow! it's working man :).

Under of Thanks spokes2112 for uploading and I appreciate your work.

all buttons and knobs are working great. again thanks alot.

  • Upvote 1

Share this post


Link to post
Share on other sites

Hello spokes2112,

the interface is crashing fsx when i fly other air craft except 737...when unload 737SpdControl.lua then fsx does not crach.
also help me how do i on/off C/O button using C# without touching fsuipc?

Share this post


Link to post
Share on other sites

Ahh.. Possibly a small bug in the check routine. Just turn the routine off and it should work for you. 
Around line 7 change local a = 1 to local a = 0 
There will be no more confirmation of operation display after this, just check operation by toggling the C/O button or other lua command.

If that doesn't work just set it up as an [Auto.<profile name>] to start only with the stock 737.

Sorry, cant help with the C# portion - out of my league. Just FYI, all C/O buttons are custom for different aircraft.
There is no built in command for the operation.

Share this post


Link to post
Share on other sites

Thank you very much spokes2112...now it's working fine. not crashing...I converted your coButton lua code into C#...it's working also. :) 
 

private void coButton() {
     if (FSUIPCConnection.ReadLVar("CO_state") == 0)
        FSUIPCConnection.WriteLVar("CO_state", 1);
     else
        FSUIPCConnection.WriteLVar("CO_state", 0);

}

 

  • Upvote 1

Share this post


Link to post
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
Sign in to follow this