Sign in to follow this  
Guest prospector21

xml - what am I doing wrong?

Recommended Posts

A little section of code for another one of my gauges. Trying to display 1 of 4 images based on a value range. Found that dividing the ADF1 Signal by 180 gives about the right distance for each of the imgaes to display. Also found that using "div" verus "/" gives whole number with no fraction. Used String to display and results look good 0,1,2,3,4 and so on... But with the following only the "RH_Sig0.bmp" will display..?? ((A:ADF1 SIGNAL, enum) 180 div)Qustion; Can "Case Value =" support conditonal ranges? ex: Case Value= "0 = ! 140 %lt"Many thanks....

Share this post


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

I'd probably have to test this to get it right, but as I recall, the maximum value of a signal strength is 256, so dividing that by 180 is going to give you a maximum value of 1 with rounding. Try dividing by 64 instead of 180. Also, try using (A:ADF1 signal, NUMBER), instead of ENUM.I'd say you're problem probably stems from rounding in any case. If you're only getting Sig0 to display it means you're only getting a 0 result. When you display your string for testing purposes, make sure you're displaying the value as an integer.--Jon

Share this post


Link to post
Share on other sites

Oh, the second part of your question about the value of "case". You cannot use arguments there as far as I know.--Jon

Share this post


Link to post
Share on other sites

Thanks so much for the reply - The ADF max singal is 50,000 and the range from 0 to 255 is no or poor signal. Anything 256 and above is a good signal. With the following; %((A:ADF1 SIGNAL, enum) 180 div)%!06.2f!I can watch the signal level change as I move from the NDB. I tried other values to dive by but 180 is about the best to give me 4 equal points along the signal path.I also tried using "number" instead of "enum", but same result. Rounding should not be a problem with using "div" since it returns only a whole number. Still stuck....??

Share this post


Link to post
Share on other sites

Try removing the enclosing parentheses ( ) ((A:ADF1 SIGNAL, enum) 180 div) (A:ADF1 SIGNAL, enum) 180 divRegards,Roman

Share this post


Link to post
Share on other sites

Not tested, but you can try to use (A:ADF1 SIGNAL, enum) 180 div 0 > (A:ADF1 SIGNAL, enum) 180 div 1 < && (A:ADF1 SIGNAL, enum) 180 div 1 > (A:ADF1 SIGNAL, enum) 180 div 2 < &&Hope it helps,Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Thank you so much for the help from both of you, I now have it working correctly!! Removing the extra parentheses did the trick, but in the case of the statement, both sets of parentheses are still needed. If you remove the parentheses like that in the statement the display shows some like "%!06.2f!". After final tweaking found that a value of "144 div" results in the following singal; (@3000')image0 (grayed out,no signal) >36 miles from NDBimage1 (one colored bar on) 36 to 31 miles from NDBimage2 (two colored bars on) 30 to 21 miles from NDBimage3 (three colored bars on) 20 to 15 miles from NDBimage4 (all 4 colored bars on) <15 miles from NDB-----------------------;-)Any Landing You can Walk Away from is a Good Landing!!!!

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