Jump to content
Sign in to follow this  
taguilo

Altimeter Help !!!

Recommended Posts

Guest codvir

Hi all,My English is not native.I am building Altimeter gauge that use needle and analog numbers.everything is working but it is not displaying it as I want.In the analog numbers I used the SHIFT to move the strip up and it sliding the number without problem BUT I dont want it to slide, for example: if I am at 10000 feet I want it to change from 09999 to 10000 without the sliding all the way, from 0 to 1, from 1 to 2 and so on without the sliding thing.I hope you will understand me, as I said before the English is not native.I am attaching the source code: <?xml version="1.0" encoding="UTF-8" ?> - Bla Bla BlaBla.xml - 0.000,0.000247,270 - True- 63.000,82.000 - True0.000,317.000 - 0.000,0.003 - 0.000100000.000 I hope you can help me.Thanks

Share this post


Link to post
Share on other sites
Guest coolfsx

1) I think there is no AXIS in the MASKIMAGE.2) I think you need yo add something to the script but I don't know what.if I understand you right you want to switch the 1 with 2 when you rich 20000 feet and not slinding from 1 to 2 and so on.I hope I helped you with some directions.COOLFSX

Share this post


Link to post
Share on other sites
Guest codvir

I want to switch the Ten-Thousends analog number like this:Just before the aircraft rich the 10,000 feet it will switch the 0 digit with the 1 digit, as the aircraft rich 20,000 feet it will switch the 1 digit with 2 digit and so on....right now it working but the digits are sliding all the way from 0 to 1 and from 1 to 2 and so on....I just want them to switch second before the aircraft rich the alt.Thanks

Share this post


Link to post
Share on other sites

>I want to switch the Ten-Thousends analog number like this:>>Just before the aircraft rich the 10,000 feet it will switch>the 0 digit with the 1 digit, as the aircraft rich 20,000 feet>it will switch the 1 digit with 2 digit and so on....>>right now it working but the digits are sliding all the way>from 0 to 1 and from 1 to 2 and so on....>>I just want them to switch second before the aircraft rich the>alt.Well, if that's what you want, why are you even using SHIFT (sliders) at all? You could simply use a String instead! ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest codvir

>Well, if that's what you want, why are you even using SHIFT>(sliders) at all? You could simply use a String instead! ;)>Can you help me with an example of this string?? I notice that other panels using the SHIFT and when the analog digits show 19998-19999 the TEN THOUSENDS number start to move but not before or all the way from 10000 to 20000.I am using BMP as strip.folks, I need that the anaglg strip I am using will start to "roll" or "slide" few feets before riching the 10,000 or 20,000 and so on.Thanks

Share this post


Link to post
Share on other sites
Guest jimcooper1

CODVIRIn a normal tumbler type display the Units digit moves in a linear fashion but the other digits (Tens, Hundreds, Thousands etc) only move to the next digit whilst the units digit is 'rolling' from the 9 to the 0. Is this what you are trying to achieve?OR as Bill Leaming interpreted do you want the digits to behave as they would in a Digital readout ie the numbers don't roll they just change?Jim

Share this post


Link to post
Share on other sites
Guest codvir

Hi Jim,the first option is what I need.Tens Hundreds and thousands need to move to the second digit while the units is rolling from 9 to 0.How can I achive it?Thanks

Share this post


Link to post
Share on other sites
Guest jimcooper1

CODVIR,I specialise in C-gauges and leave my friends/colleagues to do the XML ones. So I've only ever written tumblers in C never in XML.Basically i take the altitude and break it down in to its UNITS, TENS, HUNDREDS, THOUSANDS etc and assign these to variables. I then check IF the UNITS value is greater than 9 THEN move the TENS at the same rate that the UNITS are moving. Similarly if the UNITS are greater than 9 AND (&&) the TENS are greater than 9 THEN move the HUNDREDS at the same rate as the UNITS are moving.There is probably a much more elegant way of doing this in XML but I'm afraid I don't have example code to share with you.regardsJim

Share this post


Link to post
Share on other sites
Guest codvir

Hi Jim,I absolute understnad you. I am coming also from c++ and c# but I wanted to understand how to do it in XML.I think I will transfer my self to the c++ again.thanks

Share this post


Link to post
Share on other sites
Guest jimcooper1

>Hi Jim,>>I absolute understnad you. I am coming also from c++ and c#>but I wanted to understand how to do it in XML.>>I think I will transfer my self to the c++ again.>>thanksIn which case..Have this:MODULE_VAR baro_alt = {ALT_FROM_BAROMETRIC_PRESSURE};MOVING_IMAGE_UPDATE_CALLBACK commonX_var;MOVING_IMAGE_UPDATE_CALLBACK moving_card_10_cb;FLOAT64 plane_height = 0;UINT32 plane_height_var = 0;UINT32 plane_height_100 = 0;UINT32 digit_10 = 0;UINT32 plane_height_1000 = 0;UINT32 digit_100 = 0;UINT32 plane_height_10000 = 0;UINT32 digit_1000 = 0;UINT32 digit_10000 = 0;FLOAT64 FSAPI commonX_var(PELEMENT_MOVING_IMAGE pelement){ return 1.0; //Dummy callback}FLOAT64 FSAPI moving_card_10_cb(PELEMENT_MOVING_IMAGE pelement){ lookup_var(&baro_alt); //current plane altitude plane_height = baro_alt.var_value.n; //plane_height = plane_height * 3.28083989501312; //convert metres to feet if(plane_height>0){ plane_height_var = plane_height; plane_height_100 =plane_height_var/100; digit_10 =plane_height_var - plane_height_100*100; return 100-digit_10; } else{ plane_height_var = plane_height*-1; plane_height_100 =plane_height_var/100; digit_10 =plane_height_var - plane_height_100*100; return 100-digit_10; }}FLOAT64 FSAPI moving_card_100_cb(PELEMENT_MOVING_IMAGE pelement){ lookup_var(&baro_alt); //current plane altitude plane_height = baro_alt.var_value.n; //plane_height = plane_height * 3.28083989501312; //convert metres to feet if(plane_height>0){ plane_height_var = plane_height; plane_height_1000 =plane_height_var/1000; digit_100 =plane_height_var - plane_height_1000*1000; digit_100 = digit_100 / 100; if(digit_10<90){ return 1000-100*digit_100; } else{ return 1000-(100*digit_100 + 10*(digit_10 -90)); } } else{ plane_height_var = plane_height*-1; plane_height_1000 =plane_height_var/1000; digit_100 =plane_height_var - plane_height_1000*1000; digit_100 = digit_100 / 100; if(digit_10<90){ return 1000-100*digit_100; } else{ return 1000-(100*digit_100 + 10*(digit_10 -90)); } }}FLOAT64 FSAPI moving_card_1000_cb(PELEMENT_MOVING_IMAGE pelement){ lookup_var(&baro_alt); //current plane altitude plane_height = baro_alt.var_value.n; //plane_height = plane_height * 3.28083989501312; //convert metres to feet if(plane_height>0){ plane_height_var = plane_height; plane_height_10000 =plane_height_var/10000; digit_1000 =plane_height_var - plane_height_10000*10000; digit_1000 = digit_1000/1000; if(digit_100<9 ){ return 10000-1000*digit_1000; } else{ if(digit_10<90 ){ return 10000-1000*digit_1000; } else{ return 10000-(1000*digit_1000 + 100*(digit_10 -90)); } } } else{ plane_height_var = plane_height*-1; plane_height_10000 =plane_height_var/10000; digit_1000 =plane_height_var - plane_height_10000*10000; digit_1000 = digit_1000/1000; if(digit_100<9 ){ return 10000-1000*digit_1000; } else{ if(digit_10<90 ){ return 10000-1000*digit_1000; } else{ return 10000-(1000*digit_1000 + 100*(digit_10 -90)); } } }}FLOAT64 FSAPI moving_card_10000_cb(PELEMENT_MOVING_IMAGE pelement){ lookup_var(&baro_alt); //current plane altitude plane_height = baro_alt.var_value.n; //plane_height = plane_height * 3.28083989501312; //convert metres to feet if(plane_height>0){ plane_height_var = plane_height; digit_10000 = plane_height_var/10000; if(digit_1000<9 ){ return 100000-10000*digit_10000; } else{ if(digit_100<9 ){ return 100000-10000*digit_10000; } else{ if(digit_10<90 ){ return 100000-10000*digit_10000; } else{ return 100000-(10000*digit_10000 + 1000*(digit_10 -90)); } } } } else{ return 110000; }}RegardsJim

Share this post


Link to post
Share on other sites
Guest codvir

>>Hi Jim,>>>>I absolute understnad you. I am coming also from c++ and c#>>but I wanted to understand how to do it in XML.>>>>I think I will transfer my self to the c++ again.>>>>thanks>>In which case..Have this:>>MODULE_VAR baro_alt = {ALT_FROM_BAROMETRIC_PRESSURE};>MOVING_IMAGE_UPDATE_CALLBACK commonX_var;>MOVING_IMAGE_UPDATE_CALLBACK moving_card_10_cb;>>FLOAT64 plane_height = 0;>UINT32 plane_height_var = 0;>UINT32 plane_height_100 = 0;>UINT32 digit_10 = 0;>UINT32 plane_height_1000 = 0;>UINT32 digit_100 = 0;>UINT32 plane_height_10000 = 0;>UINT32 digit_1000 = 0;>UINT32 digit_10000 = 0;>>>FLOAT64 FSAPI commonX_var(PELEMENT_MOVING_IMAGE pelement)>{> return 1.0; //Dummy callback>}>>>FLOAT64 FSAPI moving_card_10_cb(PELEMENT_MOVING_IMAGE>pelement)>{> lookup_var(&baro_alt); //current plane altitude> plane_height = baro_alt.var_value.n;> //plane_height = plane_height * 3.28083989501312; //convert>metres to feet> > if(plane_height>0){> plane_height_var = plane_height;> plane_height_100 =plane_height_var/100;> digit_10 =plane_height_var - plane_height_100*100;> return 100-digit_10;> }> else{> plane_height_var = plane_height*-1;> plane_height_100 =plane_height_var/100;> digit_10 =plane_height_var - plane_height_100*100;> return 100-digit_10;> }>}>>>FLOAT64 FSAPI moving_card_100_cb(PELEMENT_MOVING_IMAGE>pelement)>{> lookup_var(&baro_alt); //current plane altitude> plane_height = baro_alt.var_value.n;> //plane_height = plane_height * 3.28083989501312; //convert>metres to feet> if(plane_height>0){> plane_height_var = plane_height;> plane_height_1000 =plane_height_var/1000;> digit_100 =plane_height_var - plane_height_1000*1000;> digit_100 = digit_100 / 100;> if(digit_10<90){> return 1000-100*digit_100;> }> else{> return 1000-(100*digit_100 + 10*(digit_10 -90));> }> }> else{> plane_height_var = plane_height*-1;> plane_height_1000 =plane_height_var/1000;> digit_100 =plane_height_var - plane_height_1000*1000;> digit_100 = digit_100 / 100;> if(digit_10<90){> return 1000-100*digit_100;> }> else{> return 1000-(100*digit_100 + 10*(digit_10 -90));> }> }>}>>FLOAT64 FSAPI moving_card_1000_cb(PELEMENT_MOVING_IMAGE>pelement)>{> lookup_var(&baro_alt); //current plane altitude> plane_height = baro_alt.var_value.n;> //plane_height = plane_height * 3.28083989501312; //convert>metres to feet> if(plane_height>0){> plane_height_var = plane_height;> plane_height_10000 =plane_height_var/10000;> digit_1000 =plane_height_var - plane_height_10000*10000;> digit_1000 = digit_1000/1000;> > if(digit_100<9 ){> return 10000-1000*digit_1000;> }> else{> if(digit_10<90 ){> return 10000-1000*digit_1000;> }> else{> return 10000-(1000*digit_1000 + 100*(digit_10 -90));> }> }> }> else{> plane_height_var = plane_height*-1;> plane_height_10000 =plane_height_var/10000;> digit_1000 =plane_height_var - plane_height_10000*10000;> digit_1000 = digit_1000/1000;> > if(digit_100<9 ){> return 10000-1000*digit_1000;> }> else{> if(digit_10<90 ){> return 10000-1000*digit_1000;> }> else{> return 10000-(1000*digit_1000 + 100*(digit_10 -90));> }> }> }>}>FLOAT64 FSAPI moving_card_10000_cb(PELEMENT_MOVING_IMAGE>pelement)>{> lookup_var(&baro_alt); //current plane altitude> plane_height = baro_alt.var_value.n;> //plane_height = plane_height * 3.28083989501312; //convert>metres to feet> if(plane_height>0){> > plane_height_var = plane_height;> digit_10000 = plane_height_var/10000;> > if(digit_1000<9 ){> return 100000-10000*digit_10000;> }> else{> if(digit_100<9 ){> return 100000-10000*digit_10000;> }> else{> if(digit_10<90 ){> return 100000-10000*digit_10000;> }> else{> return 100000-(10000*digit_10000 + 1000*(digit_10 -90));> }> }> }> }> else{> return 110000;> }>}>>>Regards>>JimHi Jim,THANKS ALOT !!!!

Share this post


Link to post
Share on other sites
Guest codvir

do you have resources for the c/c++ gauges.I mean web site or whatever with c/c++ gauge source samples??Thanks

Share this post


Link to post
Share on other sites
Guest jimcooper1

Sorry I don'tHopefully with my explanation of the theory and the code sample I posted you will be able to work it out for yourself.Most altimeters have as their UNITS dial 00-10-20-30-40-50-60-70-80-90-00 or just 00-20-40-60-80-00Lets say that the altitude is currently 13876 feet.plane_height_var=13876plane_height_100 = plane_height_var / 100 = 13876/100 = 138digit_10 = plane_height_var -plane height_100 * 100 = 13876 - 13800 =76So the value returned to the UNITS moving card is 76 Hope this helpsRegardsJim

Share this post


Link to post
Share on other sites

To have scrolling tapes use original or based on original and remove the "flr" operator.For retrieving the ".01s"High precision , scrolling100000 + 100 * 10 %______________________________________________ For retrieving the ".1s"high precision w/ snap, 100000 + 100 * d 1 % r flr 100 % d 10 / flr r 10 % 9 == if{ + } -OR-High precision based on original100000 + 10 * 10 % flr-OR- ORIGINAL, scrolling 10 * 10 % ______________________________________________ For retrieving the "ones"high precision w/ snap 100000 + 100 * d 1 % r flr 1000 % d 100 / flr r 100 % 99 == if{ + } -OR-ORIGINAL, scrolling10 %______________________________________________ For retrieving the "tens"high precision w/ snap100000 + 100 * d 1 % r flr 10000 % d 1000 / flr r 1000 % 999 == if{ + } -OR-High precision based on original100000 + 100 % 10 / flr -OR-(ORIGINAL)100 % 10 / flr ______________________________________________ For retrieving the "hundreds"high precision w/ snap100000 + d 1 % r flr 1000 % d 100 / flr r 100 % 99 == if{ + }-OR-High precision based on original100000 + 1000 % 100 / flr -OR-ORIGINAL1000 % 100 / flr______________________________________________ For retrieving the "thousands"high precision w/ snap100000 + d 1 % r flr 10000 % d 1000 / flr r 1000 % 999 == if{ + } -OR-High precision based on original100000 + 100000 % 1000 % 100 / flr -OR-ORIGINAL100000 % 1000 % 100 / flr______________________________________________ Microsoft originals Alt window 747.For "1s" scrolling10 %For "10s" snappeds1 10 / 10 % flr l1 10 % 9 > if{ l1 10 % 9 - + }For "100s" snappeds1 100 / 10 % flr l1 100 % 99 > if{ l1 10 % 9 - + }For "1000s" snappeds1 1000 / 10 % flr l1 1000 % 999 > if{ l1 10 % 9 - + }For "10,000s" snappeds1 10000 / 10 % flr l1 10000 % 9999 > if{ l1 10 % 9 - + }Regards,Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest codvir

Hi Roman,Thank alot but can you help me to add the "Tens Thousands" to the code I wrote in the first message, it will help me alot.Thanks

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...