Jump to content
Sign in to follow this  
Eberhard

One display / multiple switches

Recommended Posts

I am currently designing gauges based on the Electronis International. I have progressed relatively far, with all the basic gauges.I am working on the R1 -gauge. It has a digital readout of the RPM and has 17 LEDS indicating the current engine RPM. Then it consists of two buttons. The one on the left shows Flight Time and the one on the right Tach Time.I have written all the code for the different elements and everything is working fine. But what has me stumped is this.When I press the TACH TIME switch it needs to clear the window and display the GENERAL ENG ELAPSED TIME - which I got working, but if I press the other button to display the Flight Time I get overlayed information, i.e. the RPM indication does not get cleared and the Flight Time gets superimposed on that. I guess I'm doing something wrong with assigning the switches.Here is part of my code (A:Circuit general panel on,bool) (A:Electrical master battery,bool) &&(L:r1 switch,enum) 0 ==%((A:General eng1 rpm,RPM))%!4d!(A:Circuit general panel on,bool) (A:Electrical master battery,bool) &&(L:r1 switch,enum) 0 ==%(L:Clock Chronograph Accumulated, minutes) (L:Clock Chronograph Mode, number) 1 == if{ (P:Absolute time, minutes) (L:Clock Chronograph Start, minutes) - + } 15 % flr (A:Circuit general panel on,bool) (A:Electrical master battery,bool) &&(L:r1 switch,enum) 1 ==%((A:GENERAL ENG ELAPSED TIME:1,hours))%!05.2f! (L:r1 switch,enum) 1 < if{ (L:r1 switch,enum) 1 + (>L:r1 switch,enum) } els{ 0 (>L:r1 switch,enum) } (L:r1 switch,enum) 0 > if{ (L:r1 switch,enum) 1 - (>L:r1 switch,enum) } els{ 1 (>L:r1 switch,enum) } Could anybody please help me getting the switching sorted out?Thanks and regardsEberhard------------------------------------Eberhard Haberkornhttp://www.focusthink.com/~weather-maker/betatester.jpghttp://www.focusthink.com/~weather-maker/proudsupporter.jpg

Share this post


Link to post
Share on other sites

Hi,Not tested, but may be this is enough:etc.%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum) 1 ==)%{if}%(L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 == if{ (P:Absolute time,minutes) (L:Clock Chronograph Start,minutes) - + } 15 % flr %{else}%((A:GENERAL ENG ELAPSED TIME:1,hours))%!05.2f!%{end}%{end}1 (>L:r1 switch,enum) 0 (>L:r1 switch,enum) Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi Janthanks for your reply. The part with the switches work only partly. When I run the panel first the gauge shows the RPM and the fligh time simuntaneously. When I press the right switch the display clears instead of showing Tach Time. When I press the left switch I have both, the RPM and Flight Time showing.My code now looks like this.(A:Circuit general panel on,bool) (A:Electrical master battery,bool) &&(L:r1 switch,enum) 0 ==%((A:Circuit general panel on,bool) (A:Electrical master battery,bool)and)%{if}%((L:r1 switch,enum) 1 ==)%{if}%(L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 == if{ (P:Absolute time,minutes) (L:Clock Chronograph Start,minutes) - + } 15 % flr %{else}%((A:GENERAL ENG ELAPSED TIME:1,hours))%!4.2f!%{end}%{end} 1 (>L:r1 switch,enum) 0 (>L:r1 switch,enum) Could you please shortly explain the if { else { notation to me, so that I can figure things out myself. The only programming I do is ASP and many moons ago I programmed in Turbo Pascal. I'm afraid that my knowledge of C and any derivative thereof is foreign to me.Is the code for the flight time correct?Sorry to burden you with this, but since you answered... ;)Many thanks for your helpEberhard------------------------------------Eberhard Haberkornhttp://www.focusthink.com/~weather-maker/betatester.jpghttp://www.focusthink.com/~weather-maker/proudsupporter.jpg

Share this post


Link to post
Share on other sites

Hi,Test this one:%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum) 1 ==)%{if}tacho%{else}time%{end}%{end}r1 on 1 (>L:r1 switch,enum) r1 off 0 (>L:r1 switch,enum) You will see "tacho" and "time" alternately.In the string there is nothing more than some conditions to show the text as in between tags.Now you also don't need the tags.So code becomes more efficient.your code for tacho:%(L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 == if{ (P:Absolute time,minutes) (L:Clock Chronograph Start,minutes) - + } 15 % flr %will not show anything.The one for elapsed time will.I use:%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f! (hours and minutes)So substitude:%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum) 1 ==)%{if}tacho%{else}%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f!%{end}%{end}Now find something for the other one!Try:%((L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 ==)%{if}%((P:Zulu time,minutes) (L:Clock Chronograph Start,minutes) + 60 % flr)%!02d!%{end}So, finally:%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum) 1 ==)%{if}%((L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 ==)%{if}%((P:Zulu time,minutes) (L:Clock Chronograph Start,minutes) + 60 % flr)%!02d!%{end}%{else}%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f!%{end}%{end}Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi Janthank you very much for the extensive answer.I stepped through your examples as suggested. I did see tacho, when I clicked on the right hand switch (r1 on). When I clicked on the let hand switch, my RPM was again displayed. I never saw the time message.The part with the Engine time works very well.I don't get any result from the flight time section. The screen is blank. Ok, I haven't waited a while for something to appear. What should the display show on start of the flight? Should the display be blank?I attached a screenshot of the original image of the gauge. I used this as the basis for my rendition of the gauge.My initial idea for this was as the attached image suggests. By clicking on Tach time, the RPM gets substituted with the Engine time. After a delay the display should switch back to the RPM. The same applies for the Flight Time. Am I trying the impossible? This one has really got me baffled. Hence my question. I thought this forum would be the best place to start. You have already helped me a great deal. Thanks!!!RegardsEberhard------------------------------------Eberhard Haberkornhttp://www.focusthink.com/~weather-maker/betatester.jpghttp://www.focusthink.com/~weather-maker/proudsupporter.jpg

Share this post


Link to post
Share on other sites

Hi,What you want is very good possible, but only nowI see you need 3 different values in one display.You can achieve that in the click section, with something in between tags or, more complicated in the string:When you click, you will acivate a timer and as long as the timer is active you will see the time or tach and thereafter again the rpm'sShould work, not tested.(P:absolute time,seconds) (L:r1 switch timer A,enum) > if{ 1 (>L:r1 switch,enum) 0 (>L:r1 switch timer A,enum) } els{ 0 (>L:r1 switch,enum) } (P:absolute time,seconds) (L:r1 switch timer B,enum) > if{ 2 (>L:r1 switch,enum) 0 (>L:r1 switch timer B,enum) } els{ 0 (>L:r1 switch,enum) } %((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum) 0 ==)%{if}%((A:General eng1 rpm,RPM))%!4d!%{else}%((L:r1 switch,enum) 1 ==)%{if}%((L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 ==)%{if}%((P:Zulu time,minutes) (L:Clock Chronograph Start,minutes) + 60 % flr)%!02d!%{end}%{else}%((L:r1 switch,enum) 2 ==)%{if}%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f!%{end}%{end}%{end}r1 A (tach)(P:absolute time,seconds) 10 + (>L:r1 switch timer A,enum) r1 B (time)(P:absolute time,seconds) 10 + (>L:r1 switch timer B,enum) When you click tach or time will be visible during about 10 seconds and after that again the rpm's.Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Had a closer look,more simple:(P:absolute time,seconds) (L:r1 switch timer,enum) > if{ 0 (>L:r1 switch,enum) 0 (>L:r1 switch timer,enum) } Another way for the string:%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum))%{case}%{:0}%((A:General eng1 rpm,RPM))%!4d!%{:1}%((L:Clock Chronograph Accumulated,minutes) (L:Clock Chronograph Mode,number) 1 ==)%{if}%((P:Zulu time,minutes) (L:Clock Chronograph Start,minutes) + 60 % flr)%!02d!%{end}%{:2}%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f!%{end}%{endr1 tach 1 (>L:r1 switch,enum) (P:absolute time,seconds) 10 + (>L:r1 switch timer,enum) r1 time 2 (>L:r1 switch,enum) (P:absolute time,seconds) 10 + (>L:r1 switch timer,enum) Will test it tonight when home.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi,Tested it and it works.(Took some other values, for the "chrono thing")reduced 10 to 2, here is the code:(P:absolute time,seconds) (L:r1 switch timer,enum) > if{ 0 (>L:r1 switch,enum) 0 (>L:r1 switch timer,enum) } (The same)%((A:Circuit general panel on,bool) (A:Electrical master battery,bool) and)%{if}%((L:r1 switch,enum))%{case}%{:0}%((A:General eng1 rpm,RPM))%!4d!%{:1}%((P:Zulu time,minutes) 60 % flr)%!02d!%{:2}%((A:GENERAL ENG ELAPSED TIME:1,seconds) 3600 / d 1 % 60 * r flr )%!5.0f! : %!02.0f!%{end}%{endr1 tach 1 (>L:r1 switch,enum) (P:absolute time,seconds) 2 + (>L:r1 switch timer,enum) r1 time 2 (>L:r1 switch,enum) (P:absolute time,seconds) 2 + (>L:r1 switch timer,enum) NB. Don't mind the positions and text changes.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Hi JanThank you again for your help. Your tips work very well. I am so happy. The engine time in your code differs from the time on the default Cessna counter. Latter displays 1.8 and the digital read out displays 60.The next thing I need to figure out is the flight time counter.I appreciate your help.Thanks and regardsEberhard------------------------------------Eberhard Haberkornhttp://www.focusthink.com/~weather-maker/betatester.jpghttp://www.focusthink.com/~weather-maker/proudsupporter.jpg

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