Sign in to follow this  
Guest ptwaugh

Fuel Selector "Toggle" Switch

Recommended Posts

Hi FolksI need help in making a simple switch that will toggle the fuel selector on and off. I can't seem to find a toggle command for this function.Simply put, I want a switch ( similar in design and fuction to the battery master on the Baron) that when up gives: (>K:FUEL_SELECTOR_ALL) (*turns fuel selector on*)and when down:(>K:FUEL_SELECTOR_OFF)(*turns fuel selector off*)maybe its done with the enum function, but I'm baffled.Can anyone point me in the right direction?ThanksSteve

Share this post


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

Hi,I think:(A:Fuel Sel.... ,enum) 0 == (A:Fuel Sel.... ,enum) 1 == (0=Off;1=All)Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Steve,Yes, Fuel_Selector is an enumerated variable. Banged the attached together in a few minutes with EasyGauge, if you want to have a look. The extent of my testing with it was to put it on my test panel. Toggling the switch had the effect of killing all the engines.Syntax would be something like:gauge11=FuelTankSelector!FuelTankSelector, 279,433,25Doug Dawsonhttp://forums.avsim.net/user_files/41492.zip

Share this post


Link to post
Share on other sites

You are correct. Here is the whole list of values if you want to get really fancy: FUEL_TANK_SELECTOR_OFF = 0, FUEL_TANK_SELECTOR_ALL = 1, FUEL_TANK_SELECTOR_LEFT = 2, FUEL_TANK_SELECTOR_RIGHT = 3, FUEL_TANK_SELECTOR_LEFT_AUX = 4, FUEL_TANK_SELECTOR_RIGHT_AUX = 5, FUEL_TANK_SELECTOR_CENTER = 6, FUEL_TANK_SELECTOR_CENTER2 = 7, FUEL_TANK_SELECTOR_CENTER3 = 8, FUEL_TANK_SELECTOR_EXTERNAL1 = 9, FUEL_TANK_SELECTOR_EXTERNAL2 = 10, FUEL_TANK_SELECTOR_RIGHT_TIP = 11, FUEL_TANK_SELECTOR_LEFT_TIP = 12, FUEL_TANK_SELECTOR_CROSSFEED = 13, FUEL_TANK_SELECTOR_CROSSFEED_L2R = 14, FUEL_TANK_SELECTOR_CROSSFEED_R2L = 15, FUEL_TANK_SELECTOR_BOTH = 16, FUEL_TANK_SELECTOR_EXTERNAL_ALL = 17,Doug

Share this post


Link to post
Share on other sites

Thanks for the replies guysI should have stated I am working in XML:However, got it to work with this coding:(A:General eng fuel valve:1,bool) }Now the problem I have, I want the images of the switch to move ( as they do now) but the switch should only function ( turn on and off the fuel) when the master battery (A:Electrical master battery,bool) is on.Any hints on how to do this?Steve

Share this post


Link to post
Share on other sites

Steve,Sorry for throwing the C stuff at you. Wasn't sure if you were determined to get an XML answer, or it you were just looking for a switch that worked...As to your next question. Declare a G:var that you can use to control the toggling of the bitmaps. It will toggle unconditionally on your line. You will then need to throw an if statement into your line to determine whether you are going to actually toggle the fuel valve. That kind of XML is way over my head but the logic would essentially be:Toggle G:VarIf A:Electrical master battery = 1 and G:Var <> A:General eng fuel valve:1 Then TOGGLE_FUEL_VALVE_ENG1Doug

Share this post


Link to post
Share on other sites

Hi,Try adding to the tag(A:Circuit general panel on,bool) &∨ (A:ELECTRICAL MASTER BATTERY,bool) &&Result: (A:General eng1 fuel valve,bool) (A:Circuit general panel on,bool) && Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

JanThanks for the reply, but it seems that all that does is to make the actual image changing slaved to the variables, as opposed to the click event being slaved.DougI think you are on the right track, but same as you.I am stumped with this one. I have re-read Arnes FAQs higher up, plus his call back docs and seem to think that some kind of time delay is needed:So here is the poser:I need a switch to activate the fuel valve, and the switch must be tied to the master battery and also a fuel pump. The switch functions as per normal visually (off, on) BUT does not turn the fuel valve on without battery and fuel pump also being on.So here is what I have so far ( origin was the 747 engine start switch):<(G:Var9) if{ (A:Electrical master battery,bool) (A:General eng1 fuel pump switch,bool) && if{ 1 (>K:TOGGLE_FUEL_VALVE_ENG1) } els{ (G:Var9) -- (>G:Var9) } } (G:Var9) 0 != (A:General eng fuel valve:1, bool) ||25 (>G:Var9)IT ALMOST works..will not come on unless fuel pump and battery are on.......except that it flickers on and off very fast. I think I need a delay built in, as per Arnes FAQ earlier in this forum, but have had no luck in making it work yet.Steve

Share this post


Link to post
Share on other sites

Hi,I think the movements are caused by the TOGLLE command.Try to find a SET or ON/OFF event.You can use for example 0 (>K:FUEL_SELECTOR_SET,ENUM) or something with MIXTURE_SET/MIXTURE_LEAN etc.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

You'll need a delay. To implement this, you'll need to set an L var in the click section to use to 'count down' and the countdown code goes in a section (a 2nd element that doesn't control the bmp selected). Take a look at the starters in the Baron or the 747 for an example.The other problem is allowing the switch to move without effect when certain conditions exist. Test those conditions in the section and then use if{ to TOGGLE when appropriate.StickHC001ST

Share this post


Link to post
Share on other sites

You'll need a delay. To implement this, you'll need to set an L var in the click section to use to 'count down' and the countdown code goes in a section (a 2nd element that doesn't control the bmp selected). Take a look at the starters in the Baron or the 747 for an example.The other problem is allowing the switch to move without effect when certain conditions exist. Test those conditions in the section and then use if{ to TOGGLE when appropriate.StickHC001ST

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