Jump to content
Sign in to follow this  
Guest fsspn

Gauge Reset

Recommended Posts

Guest dwilliams

Hi,I'm using a gauge that once airborne I want it to reset back to zero instead of the take-off warning being on "1". 0 = off, not initiated1 = on, check for configurationWhen I press the Take Off warn gauge button, it comes on and tells me all is OK - "1". I also have this in the element code so it does go off after take-off.(A:SIM ON GROUND,bool)However, when I takeoff, it should also reset back to "0".I've tried to add the below code as Logic Code at the beginning but the warn ok light "1" still comes on at touch-down.(A:Radio height, feet) 10 > if{ (L:warn,enum) 0 }Thanks in Advance,Dan

Share this post


Link to post
Share on other sites

Logically speaking, you're offering no difference to the gauge. All it's checking is to see if the aircraft is airborne... or not.What you're wanting is to have it behave differently based on the phase of flight. It will be up to you to code in logic to determine what the current phase of flight is (takeoff, climb, cruise, descent, land).


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Guest dwilliams

Hi Ed,"What you're wanting is to have it behave differently based on the phase of flight. It will be up to you to code in logic to determine what the current phase of flight is (takeoff, climb, cruise, descent, land)."Basically, That's what I was trying to do with the code so it resets on take-off - is this code correct?(A:Radio height, feet) 10 > if{(L:warn,enum) 0 }Is the "if{ (L:warn,enum) 0 }" correct to make it change it back to zero? or should it be (>L: etc.....?Dan

Share this post


Link to post
Share on other sites

Try (G:Var1) (A:Radio height, feet) sp0 + 20 < (G:Var1) l0 >= || if{ } els{ l0 500 > (G:Var1) 500 < && if{ (your off switch L:var here) } } l0 (>G:Var1) This switches once, only climbing, at 500 feet AGL


Paul EGLD

Share this post


Link to post
Share on other sites

Hi,Most simple way would be to:-Enable take off warning only on ground (could have a speed component also)-Keep warning light on as long as aircraft is still on ground or has a minimum radio height (ie 50 ft)Therefore you have two choices: work with condition or work with conditionIf you prefer the first case:(A:Radio height, feet) 50 < (L:warn,bool) and if{ 1 } els{ 0 d (>L:warn,bool) }Second case:(A:Radio height, feet) 50 < (L:warn,bool) and if{ 1 } els{ 0 d (>L:warn,bool) }Also you need to check in the click event, supposing you want to be able to toggle the light's status only in ground:(A:Sim on ground,bool) if{ (L:warn,bool) ! (>L:warn,bool) }Hope this helpsTom

Share this post


Link to post
Share on other sites

Hi all,I've been working on something similar. Your post have help me in partially to my problem.I have a warning light that needs to stay on until the gear is raised, then goes off; however, it goes off when raised - and is supposed to stay off until I have touched down. Instead, it comes back on while I'm lowering the gear. Is there any way to keep it off until I touch down again?----I now use this for the warning gauge like yours above----(A:Radio height, feet) 50 < (L:Warn,bool) & if{ 1 } els{ 0 d (>L:Warn,bool) }--I need to add this (or similar) to make it work right---(A:Gear handle position,percent) 50 >Any help will be greatly appreciated.Thanks,Benny

Share this post


Link to post
Share on other sites

Hi,What this piece of code does:-Take Off : light is ON as long as Landing Gear is not full retracted.-Landing : light is OFF until aircraft touches down, then turning to ON. ( Supposing a Gear Up landing is avoided :-) )(A:Gear Total Pct Extended,percent) 0.5 > s0(L:Warn,bool) ! and if{ 1 }els{ l0 ! if{ 1 (>L:Warn,bool) } (L:Warn,bool) (A:Sim On Ground,bool) and if{ 0 (>L:Warn,bool) 1 } els{ 0 } }Hope this helps (and works!)Tom

Share this post


Link to post
Share on other sites

Hi Tom,Well, this is what this code is doing.(this first part is OK)-Take Off : light is ON as long as Landing Gear is not full retracted.(this part not working right)-Landing : light comes back on before landing. Any Ideas?Best Regards,Benny

Share this post


Link to post
Share on other sites

Benny, I revised the logic and still find it right...Does light come back before landing but immediately after lowering the gear?Element should contain only this structure:(A:Gear Total Pct Extended,percent) 0.5 > s0(L:Warn,bool) ! and if{ 1 }els{ l0 ! if{ 1 (>L:Warn,bool) } (L:Warn,bool) (A:Sim On Ground,bool) and if{ 0 (>L:Warn,bool) 1 } els{ 0 } }Mind l0 is "L0" and not 10, and also proper spacing.Do not use a mouse to modify (L:Warn,bool) because it's an automatic process.Tom

Share this post


Link to post
Share on other sites

Hi,Must the condition not be placed between tags and then

Share this post


Link to post
Share on other sites

Jan, the example is for a single image display. It shows when is true, or not shows at all otherwise.Tom

Share this post


Link to post
Share on other sites
Guest fsspn

just another idea (i use it in my plane, to reset local variables and to watch changes permanently):define a transparent gauge (which will not be displayed) and use the visibility code, to watch changes:<?xml version="1.0" encoding="UTF-8"?>AceXML Documentdark.xml0.000,0.000True0.000,0.000 (L:FlightTimer,enum) 100 < if{ (L:FlightTimer,enum) 1 + (>L:FlightTimer,enum) } els{ } (L:FlightTimer,enum) 99 < (A:SIM ON GROUND,bool) && if{ (A:ELECTRICAL MASTER BATTERY,bool) if{ (>K:TOGGLE_MASTER_BATTERY) } els{ } (A:LIGHT LANDING, bool) if{ (>K:LANDING_LIGHTS_OFF) } els{ } (A:LIGHT PANEL, bool) if{ (>K:PANEL_LIGHTS_OFF) } els{ } (A:LIGHT STROBE, bool) if{ (>K:STROBES_OFF) } els{ } (A:LIGHT TAXI, bool) if{ 1 (>K:TOGGLE_TAXI_LIGHTS) } els{ } (A:LIGHT WING, bool) if{ 1 (>K:TOGGLE_WING_LIGHTS) } els{ } (A:LIGHT LOGO, bool) if{ 1 (>K:TOGGLE_LOGO_LIGHTS) } els{ } (A:LIGHT CABIN, bool) if{ 1 (>K:TOGGLE_CABIN_LIGHTS) } els{ } (A:LIGHT NAV, bool) if{ 1 (>K:TOGGLE_NAV_LIGHTS) } els{ } (A:LIGHT BEACON, bool) if{ 1 (>K:TOGGLE_BEACON_LIGHTS) } els{ } (A:GENERAL ENG FUEL VALVE:1, bool) if{ 1 (>K:TOGGLE_FUEL_VALVE_ENG1) } els{ } (A:GENERAL ENG FUEL VALVE:2, bool) if{ 1 (>K:TOGGLE_FUEL_VALVE_ENG2) } els{ } (A:GENERAL ENG FUEL PUMP SWITCH:1, bool) if{ 1 (>K:TOGGLE_ELECT_FUEL_PUMP1) } els{ } (A:GENERAL ENG FUEL PUMP SWITCH:2, bool) if{ 1 (>K:TOGGLE_ELECT_FUEL_PUMP2) } els{ }... and so on ... 0 TrueTrueThis code sets all those variables to an initial value if a new flight is started (Flight timer counts the time from startup). No init is done, if you change the aircraft during a flight (because flight timer is > 100)

Share this post


Link to post
Share on other sites

Andi,Nice idea to put an initialization script in a tag instead of using .Now, just a couple of comments: -There is no need to place an empty els{ } after an if{ } when there is no alternate condition.-Indeed Local variables (L type) are reset to 0 whenever an aircraft reload/change is done, -in FSX-, hence I don't know how could your code be working as you expect it to do (?).Tom

Share this post


Link to post
Share on other sites

Hi Tom,I tried your code as above and still got the warn light at gear-down before landing. -----here is the actual code I am using-------(A:Radio height, feet) 50 < (L:Warn,bool) & if{ 1 } els{ 0 d (>L:Warn,bool) }(L:Warn,bool)---on the click,I have to be able to click on or off, but once airborne it goes off and is reset (hence the 1st above code) so it goes to "0" and stays on. I used the Case Value="0" to start so that the light would be on and active on the ground.---(L:Warn,bool) ! (>L:Warn,bool)----I have added this code as in above post in place of the "value" above and also between the "Element" & "Position" but still go the same result as mentioned above--------(A:Gear Total Pct Extended,percent) 0.5 > s0(L:Warn,bool) ! and if{ 1 }els{ l0 ! if{ 1 (>L:Warn,bool) } (L:Warn,bool) (A:Sim On Ground,bool) and if{ 0 (>L:Warn,bool) 1 } els{ 0 } }Thanks,Benny

Share this post


Link to post
Share on other sites

Benny,If you still use part of your code as you did it won't work for sure.Please remove both and leave only this one:(A:Gear Total Pct Extended,percent) 0.5 > s0(L:Warn,bool) ! and if{ 1 }els{ l0 ! if{ 1 (>L:Warn,bool) } (L:Warn,bool) (A:Sim On Ground,bool) and if{ 0 (>L:Warn,bool) 1 } els{ 0 } } (L:WarnEnabled,bool) ! and And use (L:WarnEnabled,bool) ! (>L:WarnEnabled,bool) to enable/disable light status (enabled by default at flight start)Hope this makes sense to you.Tom

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...