• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Davtron M803: Function Implementation Issues (SOLVED)

Messages
1,407
Country
mexico
Hello friends

I've been experimenting with time variables and displaying them within strings. Also, following tips kindly given by Bjoern, Luka and the FSX's online SDK (and
taking the timewatch snippets for reference). From Luka's functions in this thread, first I arranged a custom clock to learn how to get time information within custom variables and do operations. I called this test gauge "Davtron_M803_Logic_Test". This gauge, has implemented the Hour and Minute INC/DEC functions and also, the clock has the "Reset"code to set all time fields back to zero.

The "Clock with Custom Variables" works more like a chronometer.

Davtron_M803_Logic_Test.jpg


Here is the code:
HTML:
    <!--
     Bell 407 gauges Version 2.0
     Credits:
     Nick Pike for his amazing tutorials.
     Programming by Luka, Bjoern Kesten and Sergio Kauffman.
     Graphics by Sergio Kauffman.
  
     ©2018 Luka, Bjoern Kesten and Sergio Kauffman. ®All Rights Reserved.
     This software may not be copied, distributed modified, or otherwise included in any other works without permission from the Authors.
     -->
<Gauge Name="Davtron_M803_Logic_Test" Version="1.0">
      <Size X="750" Y="750"/>
      <Image Name="Davtron_M803_LT_Background.bmp"/>
    
  <!--                                                                                              S T O P W A T C H   U P D A T E   L O G I C                                                                                           -->
      <Update>
          (L:M803_offset,seconds) d 0 &lt; if{ 86400 + } (E:ZULU TIME,Seconds) + 86400 %
          d 3600 / flr (>L:M803_H,number)
          d 60 / flr 60 % (>L:M803_M,number)
          flr 60 %  (>L:M803_S,number)
      </Update>
<!--                                                                                                       C L O C K   E V E N T   L O G I C                                                                                                            -->
      <Element>
          <Position X="10" Y="10"/>
          <FormattedText X="750" Y="122" Font="Quartz" FontSize="60" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
              <String>
                  Standard Clock (24 hour format):\n
                  (%((P:LOCAL TIME,HOURS) flr 24 % d 24 r ?)%!02d!:
                  %((P:LOCAL TIME,MINUTES) flr 60 %)%!02d!:
                  %((P:LOCAL TIME,SECONDS) flr 60 %)%!02d!)
                  %{end}
              </String>
          </FormattedText>
      </Element>
    
      <Element>
          <Position X="10" Y="152"/>
          <FormattedText X="750" Y="750" Font="Quartz" FontSize="60" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
              <String>
                  Clock with Custom Variables:\n
                 <!-- Changing this line, the reset action will put the number 24 in the hour field-->
                 <!--(%((L:M803_H,number) flr 24 % d 24 r ?)%!02d!: -->
                 (%((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
                  %((L:M803_M,number) flr 60 %)%!02d!:
                  %((L:M803_S,number) flr 60 %)%!02d!)
                  %{end}
              </String>
          </FormattedText>
      </Element>
<!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                         -->
      <Mouse>
            <!-- M.1=========================Hour Increase===================================-->
            <Area Left="100" Top="489" Width="88" Height="43">
                <Tooltip>(Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                    <Click>
                        (L:M803_H,number) ++ 24 % (>L:M803_H,number)
                        (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                    </Click>
            </Area>
            <!-- M.2=========================Hour Decrease===================================-->
            <Area Left="100" Top="579" Width="88" Height="43">
                <Tooltip>(Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                    <Click>
                        (L:M803_H,number) -- 24 % (>L:M803_H,number)
                        (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                    </Click>
            </Area>
            <!-- M.3=========================Minute Increase===================================-->
            <Area Left="252" Top="489" Width="88" Height="43">
                <Tooltip>(Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                    <Click>
                        (L:M803_M,number) ++ 60 % (>L:M803_M,number)
                        (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                    </Click>
            </Area>
            <!-- M.4=========================Minute Decrease===================================-->
            <Area Left="251" Top="579" Width="88" Height="43">
                <Tooltip>(Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                    <Click>
                        (L:M803_M,number) -- 60 % (>L:M803_M,number)
                        (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                    </Click>
            </Area>
            <!-- M.5=========================Clock RESET===================================-->
            <Area Left="490" Top="489" Width="88" Height="43">
                <Tooltip>(Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                    <Click>
                        0 (>L:M803_H,number)
                        0 (>L:M803_M,number)
                        0 (>L:M803_S,number)
                        (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                    </Click>
            </Area>
      </Mouse>
    
</Gauge>

In order to understand the update section (it is the first time I use it within a gauge code), I tried to make an analysis using the stack sample shown in the wiki as reference. Here is my interpretation of the first script:

Script01_Stack_Analysis.jpg


So far, so good! It worked like I intended for. Next step was to follow the Mircrosoft's "Create a Stopwatch Gauge Tutorial" in order to enhance my previouse code for the Davtron M803. In this case, two functions remain to be properly coded: Flight and Elapsed time. Although I've readed all information at hand, I am confused on how to stablish them.

(I will split this thread in parts, starting here)
 
Last edited:
Messages
1,407
Country
mexico
I've tried my best to implement the Elapsed Time Function first.

Davtron_M803_ET.jpg


My first attempt, was to take the update part from the "Davtron_M803_Logic_Test" and display some information in the Elapsed Time function within the main code for the Davtron M803.

HTML:
    <!--                                                                                              S T O P W A T C H   U P D A T E   L O G I C                                                                                           -->
      <Update>
          (L:M803_offset,seconds) d 0 &lt; if{86400 + } (E:ZULU TIME,Seconds) + 86400 %
          d 3600 / flr (>L:M803_H,number)
          d 60 / flr 60 % (>L:M803_M,number)
          flr 60 % (>L:M803_S,number)
      </Update>

There, I succesfully displayed the time variables for the first condition:

Elapsed Time Count Up readout:
Case 1: Elapsed Time counts up 59 minutes and 59 seconds, and then switches to hours and minutes.
Case 2: Elapsed Time in hours and minutes.

Elapsed Time Count Up function:
HTML:
           <!-- LCD_B.6=========================Elapsed Time Count Up readout===================================-->
                  <Element>
                      <Visible>
                            (L:M803_Timer_Selector,number) 3 ==
                            (L:M803_LCD_Test,number) 1 !=
                            and
                      </Visible>
                      <!-- Elapsed Time counts up 59 minutes and 59 seconds, and then switches to hours and minutes.-->
                          <Element>
                          <Position X="184" Y="218"/>
                               <Visible>
                                  (L:M803_H,number) 0 ==
                              </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                  %((L:M803_M,number) flr 60 %)%!02d!:
                                  %((L:M803_S,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                          <!-- Elapsed Time in hours and minutes -->
                          <Element>
                          <Position X="184" Y="218"/>
                          <Visible>
                              (L:M803_H,number) 0 &gt;
                          </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                 %((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
                                  %((L:M803_M,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                  </Element>

Mouse Section:

HTML:
   <!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                            -->
          <Mouse>
            <!-- M.1=========================OAT / Voltage Selector===================================-->
            <Area Left="230" Top="41" Width="52" Height="52">
                <Tooltip>Function Selection (Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle">
                    (M:Event) 'LeftSingle' scmp 0 ==
                    if{ (L:M803_OAT_Volt_Selector,number) ++ 3 % (>L:M803_OAT_Volt_Selector,number) }
                </Click>
            </Area>
            
            <!-- M.2============Zulu/ Local / Flight / Elapsed Time Selector================================-->
            <Area Left="145" Top="392" Width="52" Height="52">
                <Tooltip>Timer Selector (Press LMB) / Test Mode (Press MMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+MiddleSingle+MiddleRelease">
                        (M:Event) 'LeftSingle' scmp 0 ==
                              if{ (L:M803_Timer_Selector,number) ++ 4 % (>L:M803_Timer_Selector,number) }
                        (M:Event) 'MiddleSingle' scmp 0 == if{ 1 (>L:M803_LCD_Test,number) }
                        (M:Event) 'MiddleRelease' scmp 0 == if{ 0 (>L:M803_LCD_Test,number) }
                </Click>
            </Area>
            
            <!-- M.3============ Flight Time/ Elapsed Time Set & Reset Control ============================-->
            <Area Left="327" Top="392" Width="52" Height="52">
                <Tooltip>Start or Stop (LMB) / Reset (RMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+RightSingle">
                    <!-- Control Button: Start/Stop Logic -->
                    (M:Event) 'LeftSingle' scmp 0 ==
                            if{ (L:M803_Running,bool) ! (>L:M803_Running,bool) }
                    <!-- Control Button: Reset Logic -->
                    (M:Event) 'RightSingle' scmp 0 ==
                          if{
                              0 (>L:M803_Running,bool)
                              0 (>L:M803_TotalRunning,seconds)
                              <!-- Reset timer fields to zero -->
                              0 (>L:M803_H,number)
                              0 (>L:M803_M,number)
                              0 (>L:M803_S,number)
                              (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                            }
                </Click>
            </Area>
          </Mouse>

(I will split this thread again, starting here)
 
Last edited:
Messages
1,407
Country
mexico
Ufff... almost there. From Mircrosoft's "Create a Stopwatch Gauge Tutorial", I tried to include in some way the Start/Stop function within the Elapsed Time Count Up readout section (thread#2 code)using something like this:

HTML:
(L:M803_Running,bool)
if{ (E:ZULU TIME,Seconds) (L:M803_offset,seconds) - (>L:M803_TotalRunning,seconds) }
els{ (E:ZULU TIME,Seconds) (L:M803_TotalRunning,seconds) - (>L:M803_offset,seconds) }

However, I have the strong feeling that this is not the right way to proceed. I wasn't able to take the right information from Luka's Reset function and the one in the Mircrosoft's "Create a Stopwatch Gauge Tutorial". Also, the update section is on the way as well... I am confused! Nothing seems to work and I am not sure if I need more variables :(

Also, I did another analysis from a script in the mouse section in order to learn what happens there and try to implement the conditions to Start and Stop the Elapsed Time Function using the conditions shown in the last "if" condition (shown above):

Script02_Stack_Analysis.jpg


Finally, the code written for the M803. As a side note, I partially created the "trigger" conditions to the "Flight Time" function. However, I must understand the Elapset Time first.

HTML:
    <!--
     Bell 407 gauges Version 2.0
     Credits:
     Nick Pike for his amazing tutorials.
     Programming by Luka, Bjoern Kesten and Sergio Kauffman.
     Graphics by Sergio Kauffman.

     ©2018 Luka, Bjoern Kesten and Sergio Kauffman. ®All Rights Reserved.
     This software may not be copied, distributed modified, or otherwise included in any other works without permission from the Authors.
     -->
<Gauge Name="Davtron_M803" Version="1.0">
     <Image Name="Davtron_M803_OFF.bmp"/>

    <!--                                                                                              S T O P W A T C H   U P D A T E   L O G I C                                                                                           -->
      <Update>
          (L:M803_offset,seconds) d 0 &lt; if{86400 + } (E:ZULU TIME,Seconds) + 86400 %
          d 3600 / flr (>L:M803_H,number)
          d 60 / flr 60 % (>L:M803_M,number)
          flr 60 % (>L:M803_S,number)
      </Update>
  <!--                                                                                                       C L O C K   E V E N T   L O G I C                                                                                                            -->
    <!-- Begin: Instrument in ON condition -->
               <Element>
                  <Visible>(A:Circuit general panel on, bool)</Visible>
                      <Image Name="Davtron_M803_ON.bmp" Bright="Yes"/>
                      <Failures>
                          <SYSTEM_ELECTRICAL_PANELS Action="0"/>
                      </Failures>
              
            <!-- Liquid Crystal Display 'A' Block Functions -->
            <!-- LCD_A.1========================= ======Battery Voltage================================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                      <Visible>
                          (L:M803_OAT_Volt_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:ELECTRICAL BATTERY BUS VOLTAGE, volt))%!2.1f!&#69;</String>
                            </FormattedText>
                    </Element>
            <!-- LCD_A.2========================= Ambient Temperature OAT Farenheit====================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                       <Visible>
                          (L:M803_OAT_Volt_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:AMBIENT TEMPERATURE, farenheit) 999 min)%!2.1f!&#70;</String>
                            </FormattedText>
                    </Element>
            
            <!-- LCD_A.3========================= Ambient Temperature OAT Celsius==========================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                      <Visible>
                          (L:M803_OAT_Volt_Selector,number) 2 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:AMBIENT TEMPERATURE, celsius) 999 min)%!2.1f!&#67;</String>
                            </FormattedText>
                    </Element>
            
            <!-- Liquid Crystal Display 'B' Block Functions -->
            <!-- LCD_B.1=====================Gauge Test Conditions=====================-->
                  <Element>
                      <Visible>(L:M803_LCD_Test,number) 1 ==</Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>88.88</String>
                            </FormattedText>
                  </Element>
          
                  <Element>
                      <Visible>(L:M803_LCD_Test,number) 1 ==</Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>88.88</String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.2=====================Zulu/ Local / Flight / Elapsed Time Selection Marks=====================-->
                 <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="68" Y="266"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
        
                 <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="120" Y="266"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
        
                <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 2 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="68" Y="314"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
        
                 <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 3 ==
                          (L:M803_Timer_Selector,number) 4 == or
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="120" Y="314"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
           </Element>
            <!-- LCD_B.3=========================ZULU Time readout===================================-->
                  <Element>
                      <Visible>
                          (L:M803_Timer_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      %((P:ZULU TIME, hours) 24 % flr)%!02d!:
                                      %((P:ZULU TIME, minutes) 60 % flr)%!02d!
                                  </String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.4=========================Local Time readout===================================-->
                  <Element>
                       <Visible>
                          (L:M803_Timer_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      %((P:LOCAL TIME, hours) 24 % flr)%!02d!:
                                      %((P:LOCAL TIME, minutes) 60 % flr)%!02d!
                                  </String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.5=========================Flight Time readout===================================-->
                  <Element>
                      <Visible>
                                  (L:M803_Timer_Selector,number) 2 ==
                                  (L:M803_LCD_Test,number) 1 !=
                                  and
                      </Visible>
                      <!-- Flight Time Trigger Conditions -->
                      <!-- This part, it will be refined. For now, I keep it simple: Monitoring Radio Altimeter Height to trigger the following subroutines-->
                      <Element>
                          <Select>
                              <Value>(A:Radio Height, feet) 20 &gt; if{ 1 (>L:407_Flight_Time_Trigger,bool) }</Value>
                          </Select>
                      </Element>
              
                      <Element>
                          <Select>
                              <Value>(A:Radio Height, feet) 20 &lt; if{ 0 (>L:407_Flight_Time_Trigger,bool) }</Value>
                          </Select>
                      </Element>
                      <!-- From Microsoft Online SDK (https://msdn.microsoft.com/en-us/library/cc526948.aspx)
                             Time, as referenced from 12:00 AM January 1, 0000, (Units: seconds)-->
                      <Element>
                          <Select>
                              <Value>
                                  (P:ABSOLUTE TIME, seconds) d (L:407_Timer_Offset, seconds) - r (>L:407_Timer_Offset, seconds)
                                  (L:407_Flight_Time_Trigger,bool)
                                        if{ (L:407_Flight_Time,number) + (>L:407_Flight_Time,number) }
                              </Value>
                          </Select>
                      </Element>
                      <!-- Flight Time in minutes and seconds until one hour is reached-->
                      <Element>
                      <Position X="184" Y="218"/>
                           <Visible>
                              (L:M803_H,number) 0 ==
                          </Visible>
                          <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                          <String>
                              %((L:M803_M,number) flr 60 %)%!02d!:
                              %((L:M803_S,number) flr 60 %)%!02d!
                              %{end}
                          </String>
                          </FormattedText>
                      </Element>
                      <!-- Flight Time in hours and minutes after one hour -->
                      <Element>
                      <Position X="184" Y="218"/>
                      <Visible>
                          ((L:M803_H,number) 0 &gt;
                      </Visible>
                          <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                          <String>
                             %((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
                              %((L:M803_M,number) flr 60 %)%!02d!
                              %{end}
                          </String>
                          </FormattedText>
                      </Element>
                </Element>
            <!-- LCD_B.6=========================Elapsed Time Count Up readout===================================-->
                  <Element>
                      <Visible>
                            (L:M803_Timer_Selector,number) 3 ==
                            (L:M803_LCD_Test,number) 1 !=
                            and
                      </Visible>
                      <!-- Elapsed Time counts up 59 minutes and 59 seconds, and then switches to hours and minutes.-->
                          <Element>
                          <Position X="184" Y="218"/>
                               <Visible>
                                  (L:M803_H,number) 0 ==
                              </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                  %((L:M803_M,number) flr 60 %)%!02d!:
                                  %((L:M803_S,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                          <!-- Elapsed Time in hours and minutes -->
                          <Element>
                          <Position X="184" Y="218"/>
                          <Visible>
                              (L:M803_H,number) 0 &gt;
                          </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                 %((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
                                  %((L:M803_M,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                  </Element>
    <!-- End: Instrument in ON condition -->

   <!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                            -->
          <Mouse>
            <!-- M.1=========================OAT / Voltage Selector===================================-->
            <Area Left="230" Top="41" Width="52" Height="52">
                <Tooltip>Function Selection (Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle">
                    (M:Event) 'LeftSingle' scmp 0 ==
                    if{ (L:M803_OAT_Volt_Selector,number) ++ 3 % (>L:M803_OAT_Volt_Selector,number) }
                </Click>
            </Area>
    
            <!-- M.2============Zulu/ Local / Flight / Elapsed Time Selector================================-->
            <Area Left="145" Top="392" Width="52" Height="52">
                <Tooltip>Timer Selector (Press LMB) / Test Mode (Press MMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+MiddleSingle+MiddleRelease">
                        (M:Event) 'LeftSingle' scmp 0 ==
                              if{ (L:M803_Timer_Selector,number) ++ 4 % (>L:M803_Timer_Selector,number) }
                        (M:Event) 'MiddleSingle' scmp 0 == if{ 1 (>L:M803_LCD_Test,number) }
                        (M:Event) 'MiddleRelease' scmp 0 == if{ 0 (>L:M803_LCD_Test,number) }
                </Click>
            </Area>
    
            <!-- M.3============ Flight Time/ Elapsed Time Set & Reset Control ============================-->
            <Area Left="327" Top="392" Width="52" Height="52">
                <Tooltip>Start or Stop (LMB) / Reset (RMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+RightSingle">
                    <!-- Control Button: Start/Stop Logic -->
                    (M:Event) 'LeftSingle' scmp 0 ==
                            if{ (L:M803_Running,bool) ! (>L:M803_Running,bool) }
                    <!-- Control Button: Reset Logic -->
                    (M:Event) 'RightSingle' scmp 0 ==
                          if{
                              0 (>L:M803_Running,bool)
                              0 (>L:M803_TotalRunning,seconds)
                              <!-- Reset timer fields to zero -->
                              0 (>L:M803_H,number)
                              0 (>L:M803_M,number)
                              0 (>L:M803_S,number)
                              (L:M803_H,number) 3600 * (L:M803_M,number) 60 * + (L:M803_S,number) + (E:ZULU TIME,Seconds) - (>L:M803_offset,seconds)
                            }
                </Click>
            </Area>
          </Mouse>
</Gauge>

Please, forgive me for this long attempt to try to explain to you my experiments.
In advance, thank you kindly for any hints to put me in the right direction.
Sergio.

P.S. Feel free to use the images and partial codes in your personal projects. A small favor though: Please, give credit to Luka and Bjoern Kesten as I did. ;)
 

Attachments

  • Davtron_M803.zip
    290.3 KB · Views: 185
Last edited:
Messages
1,407
Country
mexico
Ok

I have something... but not there yet. I've added this to the Elapsed Time Count Up readout in order to detect (and trigger somehow) the readings
when the "clock is running":

HTML:
                          <Element>
                                <Select>
                                    <Value>
                                        (L:M803_Running,bool)
                                                if{ (E:ZULU TIME,Seconds) (L:M803_offset,seconds) - (>L:M803_TotalRunning,seconds) }
                                            els{ (E:ZULU TIME,Seconds) (L:M803_TotalRunning,seconds) - (>L:M803_offset,seconds) }
                                      </Value>
                                </Select>
                          </Element>

From the simulator, I have the next variable readings when:
a.- (L:M803_Running,bool) is set to TRUE.
Davtron_M803_Var_inspection_00.jpg


b.- (L:M803_Running,bool) is set to FALSE:
Davtron_M803_Var_inspection_01.jpg


The variables M803_Running and M803_TotalRunning are doing what I want!. M803_Running (as stated in the Mircrosoft's "Create a Stopwatch Gauge Tutorial"), is simply a boolean indicating whether the stopwatch is running or not. However, in the Davtron M803 also is used to trigger the actions carried out by the "Select-Value" element recently included.

As you can see, the variable L:M803_TotalRunning is holding its value in "seconds". However, I haven't found the way to properly addap them to the remaining code.

Also, the first block in green, is showing the variable behavior in the Update section. Interesting, I have the idea but no the right code... yet. On the other hand, the "Elapsed Time" numeric fields are no longer able to be reseted.

This is an "updated" version of the Elapsed Time Count Up readout:
HTML:
          <!-- LCD_B.6=========================Elapsed Time Count Up readout===================================-->
                  <Element>
                      <Visible>
                            (L:M803_Timer_Selector,number) 3 ==
                            (L:M803_LCD_Test,number) 1 !=
                            and
                      </Visible>
                  
                          <Element>
                                <Select>
                                    <Value>
                                        (L:M803_Running,bool)
                                                if{ (E:ZULU TIME,Seconds) (L:M803_offset,seconds) - (>L:M803_TotalRunning,seconds) }
                                            els{ (E:ZULU TIME,Seconds) (L:M803_TotalRunning,seconds) - (>L:M803_offset,seconds) }
                                      </Value>
                                </Select>
                          </Element>
                      
                      <!-- Elapsed Time counts up 59 minutes and 59 seconds, and then switches to hours and minutes.-->
                          <Element>
                          <Position X="184" Y="218"/>
                               <Visible>
                                  (L:M803_H,number) 0 ==
                              </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                  %((L:M803_M,number) flr 60 %)%!02d!:
                                  %((L:M803_S,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                          <!-- Elapsed Time in hours and minutes -->
                          <Element>
                          <Position X="184" Y="218"/>
                          <Visible>
                              (L:M803_H,number) 0 &gt;
                          </Visible>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                              <String>
                                 %((L:M803_H,number) flr 24 % d 0 r ?)%!02d!:
                                  %((L:M803_M,number) flr 60 %)%!02d!
                                  %{end}
                              </String>
                              </FormattedText>
                          </Element>
                  </Element>

For the moment, the "Update" and "Mouse areas" remain the same.

Sergio.
 
Last edited:

Heretic

Resource contributor
Messages
6,828
Country
germany
Sorry Sergio, you absolutely lost me with that avalanche of text and code.


This is an example from a chronograph that might help.
Update/element-select-value:
Code:
(L:Clock Run Hold 1, bool)
if{ (L:Clock Chrono 1 Start,seconds) 0 == if{ (P:Absolute time, seconds) (>L:Clock Chrono 1 Start,seconds) }
(P:Absolute time, seconds) (L:Clock Chrono 1 Start,seconds) - (>L:Clock Chrono 1 Elapsed,seconds) }
(L:Clock Run Hold 1, bool) !
(L:Clock Chrono 1 Elapsed,seconds) 0 &gt; and
if{ (P:Absolute time, seconds) (L:Clock Chrono 1 Elapsed,seconds) - (>L:Clock Chrono 1 Start,seconds) }

Gauge string with blinking ":":
Code:
%((L:Clock Chrono 1 Elapsed,seconds) 3600 &lt;)%{if}%((L:Clock Chrono 1 Elapsed,seconds) 60 / 60 % flr)%!02d!%{else}%((L:Clock Chrono 1 Elapsed,seconds) 3600 / 24 % flr)%!02d!%{end}
%((P:Local time, seconds) 2 % 1 &gt; (L:Clock Run Hold 1, bool) and)%{if}:%{else} %{end}
%((L:Clock Chrono 1 Elapsed,seconds) 3600 &lt;)%{if}%((L:Clock Chrono 1 Elapsed,seconds) 60 % flr)%!02d!%{else}%((L:Clock Chrono 1 Elapsed,seconds) 60 / flr 60 %)%!02d!%{end}

Parent mouse area tooltip:
Code:
Chrono 1: %((L:Clock Chrono 1 Elapsed,seconds) 3600 / 24 % flr)%!02d!:%((L:Clock Chrono 1 Elapsed,seconds) 60 / flr 60 %)%!02d!:%((L:Clock Chrono 1 Elapsed,seconds) 60 % flr)%!02d! h

Start/Stop mouse area:
Code:
(L:Clock Run Hold 1, bool) ! (>L:Clock Run Hold 1, bool)

Start/stop mouse area tooltip:
Code:
%((L:Clock Run Hold 1, bool) !)%{if}Start Chrono 1%{else}Stop Chrono 1%{end}

Reset mouse area:
Code:
0 (>L:Clock Run Hold 1, bool) 0 (>L:Clock Chrono 1 Elapsed,seconds) 0 (>L:Clock Chrono 1 Start,seconds)

This is purely for getting the chrono right, it'll have to be integrated into the other modes.
 
Messages
1,407
Country
mexico
Sorry Sergio, you absolutely lost me with that avalanche of text and code.
No my friend, I am who's sorry :duck::duck::duck:

Thanks for the feedback, I will try it!!! :)
That is somehow precisely how I was thinking as my next step: constructing some logic within the formated text itself. Let see what happens :coffee::coffee::coffee:

EDIT 1:
I've dropped your snippets into a new gauge and I am sure it will help me a lot! Thanks to you, I am closer... closer! :cool::cool::cool:

EDIT 2:
Bjoern, your code is to good to let it go; so, I completed a new Test gauge with it. It is a perfect playground to run tests and also, it is a fully
functional chronometer. Here is the code for FS9:
HTML:
    <!--
     General Purpose Chronometer
     Programming by Bjoern Kesten.
 
     ©2018 Bjoern Kesten ®All Rights Reserved.
     This software may not be copied, distributed modified, or otherwise included in any other works without permission from the Author.
     -->
<Gauge Name="Davtron_M803_Logic_Test_02" Version="1.0">
      <Image Name="Davtron_M803_LT_02_Background.bmp"/>
      <!--                                                                                                          U P D A T E   L O G I C                                                                                                                    -->
      <!-- Update/element-select-value-->
          <Update>
              (L:Clock Run Hold 1, bool)
                  if{ (L:Clock Chrono 1 Start,seconds) 0 == if{ (P:Absolute time, seconds) (>L:Clock Chrono 1 Start,seconds) }
              (P:Absolute time, seconds) (L:Clock Chrono 1 Start,seconds) - (>L:Clock Chrono 1 Elapsed,seconds) }
              (L:Clock Run Hold 1, bool) !
              (L:Clock Chrono 1 Elapsed,seconds) 0 &gt; and
                  if{ (P:Absolute time, seconds) (L:Clock Chrono 1 Elapsed,seconds) - (>L:Clock Chrono 1 Start,seconds) }
          </Update>
<!--                                                                                                       C L O C K   E V E N T   L O G I C                                                                                                            -->
          <!--Gauge string with blinking ":": -->
          <Element>
              <Position X="150" Y="150"/>
                  <FormattedText X="750" Y="122" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                      <String>
                          %((L:Clock Chrono 1 Elapsed,seconds) 3600 &lt;)
                          %{if}
                          %((L:Clock Chrono 1 Elapsed,seconds) 60 / 60 % flr)%!02d!%{else}%((L:Clock Chrono 1 Elapsed,seconds) 3600 / 24 % flr)%!02d!
                          %{end}
                          %((P:Local time, seconds) 2 % 1 &gt; (L:Clock Run Hold 1, bool) and)
                          %{if}:%{else} %{end}
                          %((L:Clock Chrono 1 Elapsed,seconds) 3600 &lt;)
                          %{if}
                          %((L:Clock Chrono 1 Elapsed,seconds) 60 % flr)%!02d!
                          %{else}
                          %((L:Clock Chrono 1 Elapsed,seconds) 60 / flr 60 %)%!02d!
                          %{end}
                      </String>
                  </FormattedText>
          </Element>
<!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                         -->
      <Mouse>
          <!-- Parent mouse area tooltip -->
          <Area Left="13" Top="20" Width="729" Height="229">
              <Tooltip>
                  Chrono 1: %((L:Clock Chrono 1 Elapsed,seconds) 3600 / 24 % flr)%!02d!:%((L:Clock Chrono 1 Elapsed,seconds) 60 / flr 60 %)%!02d!:%((L:Clock Chrono 1 Elapsed,seconds) 60 % flr)%!02d! h
              </Tooltip>
          </Area>
          <!-- Start / Stop Function -->
          <Area Left="171" Top="489" Width="87" Height="42">
               <Tooltip>%((L:Clock Run Hold 1, bool) !)%{if}Start Chrono 1%{else}Stop Chrono 1%{end}</Tooltip>
                   <Cursor Type="Hand"/>
                   <Click Kind="LeftSingle">
                        (M:Event) 'LeftSingle' scmp 0 ==
                            if{ (L:Clock Run Hold 1, bool) ! (>L:Clock Run Hold 1, bool) }
                   </Click>
          </Area>
       
          <!-- Reset Function -->
          <Area Left="490" Top="489" Width="87" Height="42">
               <Tooltip>Reset</Tooltip>
                   <Cursor Type="Hand"/>
                   <Click Kind="RightSingle">
                        (M:Event) 'RightSingle' scmp 0 ==
                            if{
                                 0 (>L:Clock Run Hold 1, bool)
                                 0 (>L:Clock Chrono 1 Elapsed,seconds)
                                 0 (>L:Clock Chrono 1 Start,seconds)
                              }
                   </Click>
          </Area>
      </Mouse>
</Gauge>

Also, I've attached the background image. Very simple, nothing fancy but it'll do.

Goody, goody... :stirthepo
 

Attachments

  • Davtron_M803_LT_02_Background.zip
    6.1 KB · Views: 105
Last edited:
Messages
1,407
Country
mexico
Hi lads!

Bjoern, thanks to you I have it working exactly as I wanted! Acknowledgments goes as well for Luka, who also gave me nice ideas! :wizard::wizard::wizard:
I learned a lot with this gauge, specially to use the "update" function within a gauge and also to give more flavor to the Mouse areas.
Thank you both!

Here is the full working code:
HTML:
    <!--
     Bell 407 gauges Version 2.0
     Credits:
     Nick Pike for his amazing tutorials.
     Main Programming by Bjoern Kesten.
     Additional programming by Sergio Kauffman.
     Graphics by Sergio Kauffman.
   
     ©2018 Bjoern Kesten and Sergio Kauffman. ®All Rights Reserved.
     This software may not be copied, distributed modified, or otherwise included in any other works without permission from the Authors.
     -->
<Gauge Name="Davtron_M803" Version="1.0">
     <Image Name="Davtron_M803_OFF.bmp"/>
   
    <!--                                                                                              S T O P W A T C H   U P D A T E   L O G I C                                                                                           -->
      <Update>
              <!-- Flight Time Chronomenter Section -->
              <!-- Flight Time Trigger Conditions:
                    This part, it will be refined. For now, I keep it simple: Monitoring Radio Altimeter Height to trigger the following subroutines-->
              (A:Radio Height, feet) 20 &gt;
                  if{ 1 (>L:M803 Run Hold 1, bool) }
              (A:Radio Height, feet) 20 &lt;
                  if{ 0 (>L:M803 Run Hold 1, bool) }
              (L:M803 Run Hold 1, bool)
                  if{ (L:M803 Chrono 1 Start,seconds) 0 ==
                        if{ (P:Absolute time, seconds) (>L:M803 Chrono 1 Start,seconds) }
                             (P:Absolute time, seconds) (L:M803 Chrono 1 Start,seconds) - (>L:M803 Chrono 1 Flight,seconds)
                    }
              (L:M803 Run Hold 1, bool) ! (L:M803 Chrono 1 Flight,seconds) 0 &gt; and
                  if{ (P:Absolute time, seconds) (L:M803 Chrono 1 Flight,seconds) - (>L:M803 Chrono 1 Start,seconds) }
              <!--Elapsed Time Chronomenter Section -->
              (L:M803 Run Hold 2, bool)
                  if{ (L:M803 Chrono 2 Start,seconds) 0 ==
                        if{ (P:Absolute time, seconds) (>L:M803 Chrono 2 Start,seconds) }
                             (P:Absolute time, seconds) (L:M803 Chrono 2 Start,seconds) - (>L:M803 Chrono 2 Elapsed,seconds)
                    }
              (L:M803 Run Hold 2, bool) ! (L:M803 Chrono 2 Elapsed,seconds) 0 &gt; and
                  if{ (P:Absolute time, seconds) (L:M803 Chrono 2 Elapsed,seconds) - (>L:M803 Chrono 2 Start,seconds) }
      </Update>
  <!--                                                                                                       C L O C K   E V E N T   L O G I C                                                                                                            -->
    <!-- Begin: Instrument in ON condition -->
               <Element>
                  <Visible>(A:Circuit general panel on, bool)</Visible>
                      <Image Name="Davtron_M803_ON.bmp" Bright="Yes"/>
                      <Failures>
                          <SYSTEM_ELECTRICAL_PANELS Action="0"/>
                      </Failures>
                     
            <!-- Liquid Crystal Display 'A' Block Functions -->
            <!-- LCD_A.1========================= ======Battery Voltage================================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                      <Visible>
                          (L:M803_OAT_Volt_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:ELECTRICAL BATTERY BUS VOLTAGE, volt))%!2.1f!&#69;</String>
                            </FormattedText>
                    </Element>
            <!-- LCD_A.2========================= Ambient Temperature OAT Farenheit====================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                       <Visible>
                          (L:M803_OAT_Volt_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:AMBIENT TEMPERATURE, farenheit) 999 min)%!2.1f!&#70;</String>
                            </FormattedText>
                    </Element>
                   
            <!-- LCD_A.3========================= Ambient Temperature OAT Celsius==========================-->
                 <!--========================== Color 0F100E used as Black in text==========================-->
                  <Element>
                      <Visible>
                          (L:M803_OAT_Volt_Selector,number) 2 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>%((A:AMBIENT TEMPERATURE, celsius) 999 min)%!2.1f!&#67;</String>
                            </FormattedText>
                    </Element>
                   
            <!-- Liquid Crystal Display 'B' Block Functions -->
            <!-- LCD_B.1=====================Gauge Test Conditions=====================-->
                  <Element>
                      <Visible>(L:M803_LCD_Test,number) 1 ==</Visible>
                            <Position X="92" Y="112"/>
                            <FormattedText X="320" Y="106" Font="Quartz" FontSize="100" Color="#0F100E" Adjust="Center" VerticalAdjust="Center" Bright="Yes">
                               <String>88.88</String>
                            </FormattedText>
                  </Element>
                 
                  <Element>
                      <Visible>(L:M803_LCD_Test,number) 1 ==</Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>88.88</String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.2=====================Zulu/ Local / Flight / Elapsed Time Selection Marks=====================-->
                 <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="68" Y="266"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
               
                 <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="120" Y="266"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
               
                <Element>
                    <Visible>
                          (L:M803_Timer_Selector,number) 2 ==
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="68" Y="314"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
               
                 <Element>
                    <Visible>
                    <!-- (L:M803_Timer_Selector,number) 3 == is for "Elapsed Time Count Up" and (L:M803_Timer_Selector,number) 4 == for the "Elapsed Time Count Down"
                            Both, are a work in progress -->
                          (L:M803_Timer_Selector,number) 3 ==
                          (L:M803_Timer_Selector,number) 4 == or
                          (L:M803_LCD_Test,number) 1 == or
                    </Visible>
                        <Position X="120" Y="314"/>
                        <Image Name="Davtron_M803_Mark.bmp"/>
                 </Element>
           </Element>
            <!-- LCD_B.3=========================ZULU Time readout===================================-->
                  <Element>
                      <Visible>
                          (L:M803_Timer_Selector,number) 0 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      %((P:ZULU TIME, hours) 24 % flr)%!02d!
                                      <!-- Blinking ":" -->
                                      %((P:Local time, seconds) 2 % 1 &gt;)
                                      %{if}:
                                      %{else}
                                      %{end}
                                      %((P:ZULU TIME, minutes) 60 % flr)%!02d!
                                  </String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.4=========================Local Time readout===================================-->
                  <Element>
                       <Visible>
                          (L:M803_Timer_Selector,number) 1 ==
                          (L:M803_LCD_Test,number) 1 !=
                          and
                      </Visible>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      %((P:LOCAL TIME, hours) 24 % flr)%!02d!
                                      <!-- Blinking ":" -->
                                      %((P:Local time, seconds) 2 % 1 &gt;)
                                      %{if}:
                                      %{else}
                                      %{end}
                                      %((P:LOCAL TIME, minutes) 60 % flr)%!02d!
                                  </String>
                              </FormattedText>
                  </Element>
            <!-- LCD_B.5=========================Flight Time readout===================================-->
                  <Element>
                      <Visible>
                                  (L:M803_Timer_Selector,number) 2 ==
                                  (L:M803_LCD_Test,number) 1 !=
                                  and
                      </Visible>
                          <Element>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      <!-- Hours/Minutes numeric field -->
                                      %((L:M803 Chrono 1 Flight,seconds) 3600 &lt;)
                                      %{if}
                                      %((L:M803 Chrono 1 Flight,seconds) 60 / 60 % flr)%!02d!
                                      %{else}
                                      %((L:M803 Chrono 1 Flight,seconds) 3600 / 24 % flr)%!02d!
                                      %{end}
                                      <!-- Blinking ":" -->
                                      %((P:Local time, seconds) 2 % 1 &gt; (L:M803 Run Hold 1, bool) and)
                                      %{if}:
                                      %{else}
                                      %{end}
                                      <!-- Minutes/Seconds numeric field -->
                                      %((L:M803 Chrono 1 Flight,seconds) 3600 &lt;)
                                      %{if}
                                      %((L:M803 Chrono 1 Flight,seconds) 60 % flr)%!02d!
                                      %{else}
                                      %((L:M803 Chrono 1 Flight,seconds) 60 / flr 60 %)%!02d!
                                      %{end}
                                  </String>
                              </FormattedText>
                          </Element>
                </Element>
            <!-- LCD_B.6=========================Elapsed Time Count Up readout===================================-->
                  <Element>
                      <Visible>
                            (L:M803_Timer_Selector,number) 3 ==
                            (L:M803_LCD_Test,number) 1 !=
                            and
                      </Visible>
                      <!-- Elapsed Time counts up 59 minutes and 59 seconds, and then switches to hours and minutes.-->
                          <Element>
                          <Position X="184" Y="218"/>
                              <FormattedText X="400" Y="106" Font="Quartz" FontSize="110" Color="#0F100E" Adjust="Left" VerticalAdjust="Center" Bright="Yes">
                                  <String>
                                      <!-- Hours/Minutes numeric field -->
                                      %((L:M803 Chrono 2 Elapsed,seconds) 3600 &lt;)
                                      %{if}
                                      %((L:M803 Chrono 2 Elapsed,seconds) 60 / 60 % flr)%!02d!
                                      %{else}
                                      %((L:M803 Chrono 2 Elapsed,seconds) 3600 / 24 % flr)%!02d!
                                      %{end}
                                      <!-- Blinking ":" -->
                                      %((P:Local time, seconds) 2 % 1 &gt; (L:M803 Run Hold 2, bool) and)
                                      %{if}:
                                      %{else}
                                      %{end}
                                      <!-- Minutes/Seconds numeric field -->
                                      %((L:M803 Chrono 2 Elapsed,seconds) 3600 &lt;)
                                      %{if}
                                      %((L:M803 Chrono 2 Elapsed,seconds) 60 % flr)%!02d!
                                      %{else}
                                      %((L:M803 Chrono 2 Elapsed,seconds) 60 / flr 60 %)%!02d!
                                      %{end}
                                  </String>
                              </FormattedText>
                          </Element>
                  </Element>
    <!-- End: Instrument in ON condition -->
   
   <!--                                                                                                       M O U S E   E V E N T    L O G I C                                                                                                            -->
          <Mouse>
            <!-- M.1=========================OAT / Voltage Selector===================================-->
            <Area Left="230" Top="41" Width="52" Height="52">
                <Tooltip>Function Selection (Press LMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle">
                    (M:Event) 'LeftSingle' scmp 0 ==
                    if{ (L:M803_OAT_Volt_Selector,number) ++ 3 % (>L:M803_OAT_Volt_Selector,number) }
                </Click>
            </Area>
           
            <!-- M.2============Zulu/ Local / Flight / Elapsed Time Selector================================-->
            <Area Left="145" Top="392" Width="52" Height="52">
                <Tooltip>Timer Mode (Press LMB) / Test Mode (Press MMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+MiddleSingle+MiddleRelease">
                        (M:Event) 'LeftSingle' scmp 0 ==
                              if{ (L:M803_Timer_Selector,number) ++ 4 % (>L:M803_Timer_Selector,number) }
                        (M:Event) 'MiddleSingle' scmp 0 ==
                            if{ 1 (>L:M803_LCD_Test,number) }
                        (M:Event) 'MiddleRelease' scmp 0 ==
                            if{ 0 (>L:M803_LCD_Test,number) }
                </Click>
            </Area>
           
            <!-- M.3============ Flight Time/ Elapsed Time Set & Reset Control ============================-->
            <Area Left="327" Top="392" Width="52" Height="52">
                <Tooltip>Start or Stop (LMB) / Reset (RMB)</Tooltip>
                <Cursor Type="Hand"/>
                <Click Kind="LeftSingle+RightSingle">
                    <!-- Control Button: Start/Stop Logic -->
                    (M:Event) 'LeftSingle' scmp 0 ==
                            <!-- Elapsed Chronometer Section-->
                            if{ (L:M803 Run Hold 2, bool) ! (>L:M803 Run Hold 2, bool) }
                    <!-- Control Button: Reset Logic -->
                    (M:Event) 'RightSingle' scmp 0 ==
                            if{
                                 <!-- Flight Chronometer Section-->
                                 0 (>L:M803 Run Hold 1, bool)
                                 0 (>L:M803 Chrono 1 Flight,seconds)
                                 0 (>L:M803 Chrono 1 Start,seconds)
                                 <!-- Elapsed Chronometer Section-->
                                 0 (>L:M803 Run Hold 2, bool)
                                 0 (>L:M803 Chrono 2 Elapsed,seconds)
                                 0 (>L:M803 Chrono 2 Start,seconds)
                              }
                </Click>
            </Area>
          </Mouse>
</Gauge>

As a side note, I think I achieved something else on my own: Cleanliness and neat code readability!
Sergio.
:cool:
 
Last edited:

Heretic

Resource contributor
Messages
6,828
Country
germany
Well, I'll drink a Corona to that.

Actually, I won't since I bet that nobody in Mexico drinks it (just like Foster's in Australia or Heineken in Holland).
 
Messages
1,407
Country
mexico
Well, I'll drink a Corona to that.
Actually, I won't since I bet that nobody in Mexico drinks it (just like Foster's in Australia or Heineken in Holland).

Well, Corona beer isn't that...bad for a light ale. However, this is a favorite of mine (by the way, it is a German Pilsener):

Nicest_Mexican_Beer.jpg


Just like my sense of humor: Dark, bitter and very spicy. ;)
 
Last edited:

Heretic

Resource contributor
Messages
6,828
Country
germany
Google says it's almost exclusively mexican. ;)

And Pilsener is of czech origin (hence the name - Plzen (town)).
 
Messages
1,407
Country
mexico
Google says it's almost exclusively mexican. ;)

And Pilsener is of czech origin (hence the name - Plzen (town)).
My knowledge about beer is almost as bad as my gauge design; almost NULL:rotfl: :rotfl: :rotfl:
I love to learn something new each day. That is something I will write down; interesting side note!

Cheers! (literally)
Sergio.
;)
 
Messages
28
Country
unitedkingdom
Hi Antaris

I am attempting to create a utility gauge to aid in debugging a mission and have some 20 elements all working and decided to add an element showing elapsed time hrs minutes secs with a reset; your snippet appears to do exactly this, nothing fancy just the elapsed time in a box. with a couple of buttons.
My gauge is in fsx code and I am not savvy enough to convert FS 9 to FSX syntax. Is it possible that you can do this for me. Once in that format I can resize, edit it etc. to fit my gauge
BrianB
 
Messages
1,407
Country
mexico
Hello Brian

I am not very familiar with FSX gauge design and at the moment, it'll be virtually impossible. The main reason, is that I am having a big house overhauling... Probably I will be out of business for at least two months (I mean, flight simulation activities).

Meanwhile, try to experiment with the codes shown. If I can recall, there are few core differences between FS9 and FSX gauge schemas. As a side note, the big help in this regard, came from my dear friend Bjoern Kesten (aka Heretic). Feel free to use the codes in this thread, but make sure you give him a big thank you.

Kindest regards,
Sergio.
 
Messages
28
Country
unitedkingdom
Thanks for the quick response Antaris, I hope your house overhaul goes well.
I will make an attempt with your code, but as this will be my first attempt never having written one line of code using the FS 9 schema
I am not hopeful. Maybe Heretic if he reads this message will take pity on me and do it for me.
BrianB
 
Messages
1,407
Country
mexico
Maybe Heretic if he reads this message will take pity on me and do it for me.
Nope, unless you've done your very best first...

Maybe, this will help you to get the basics:
FS2X Home/Tutorials

Sooner or later, most of us went there as well to learn the basics on XML gauge programming.
Now, for FSX:
https://docs.microsoft.com/en-us/previous-versions/microsoft-esp/cc526953(v=msdn.10)

More general help here in fsdeveloper.com:
https://www.fsdeveloper.com/wiki/index.php?title=Category:Panel_and_Gauge_Design

Steps:
  1. Read the content.
  2. Be patient... Do your best to learn how the XML handles the memory stack.
  3. Experiment.
  4. Write your code and test it.
  5. Ask more questions.
Regards,
Sergio.
 
Last edited:
Messages
28
Country
unitedkingdom
Success
I created my own version of a chrono guage in FS9 then coverted it to FSX Schema.
It was almost twice the size when all the extra tags were inserted!!!!
The image below that shows the gauge in it's 3 states, while below it is incorporated into my flight-debug utility guage.
I use this during mission creation and sometimes in normal flight when using external views to save swapping backwards and forwards.
It is an 'active' gauge in that the buttons work and the yellow/blue elements can be used to change those values.
If anyone is interested respond here, I will tidy up - zip up and post
BrianB
chrono.jpg
 
Messages
113
Country
unitedstates
I would love to use that gauge. I can ALWAYS find a good use or three for it!
Yes, please zip it up and post it! It would be greatly appreciated.
Pat☺
 
Messages
1,407
Country
mexico
Hello Brian!

In my end, I've been struggling writing my own stuff; however always with tons of help from many kind and friendly people here in fsdeveloper. By looking your first steps, I am sure they will be happy to give very useful hints and tips. Lovely work and very useful indeed; if you are a "natural" coding the sky is the limit.

Congratulations!!!
Sergio.
;)
 
Top