Skip to main content Link Menu Expand (external link) Document Search Copy Copied

BooleanGauge

The BooleanGauge is a pretty powerful gauge that can be used in a number of circumstances. The simplest and most obvious is to use it as an light to indicate when something is on or off.

Example:

<gauge>
    <name>currentspeedlimitbackground</name>
    <type>BooleanGauge</type>
    <x>987</x>
    <y>79</y>
    <radius>40</radius>
    <bitvalue>192</bitvalue>				
    <xscale>0.7</xscale>
    <yscale>0.7</yscale>
    <attribute>accessorystatus1</attribute>
    <boolean_script>
        function booleanexpression : boolean;
        begin
            Result := (currentspeedlimit &#60;&#62; 0);
        end; 
        begin 
        end.
    </boolean_script>
    <colours>blue</colours>
    <onbitmap>cancellimit.bmp</onbitmap>
    <flashfrequency>0</flashfrequency>
    <visible>1</visible>
</gauge>

BooleanGauge has some additional properties including the ability to create scripts to control the status of the light, bitmaps for the on and off state, and the ability to flash the gauge on and off at a desired frequency when it is in the on state.

Attribute Mandatory? Value Type Description
x Yes Integer The x coordinate of the bottom left of the gauge
y Yes Integer The y coordinate of the bottom left of the gauge
radius Yes Integer The radius of the gauge. This is used when there are no bitmaps configured. Instead, a circle will be drawn in the specified colour to indicate the on status, and nothing will be drawn in the off status. If bitmaps are specified, then the radius is ignored but it is still mandatory.
bitvalue Yes Integer Specifies the bit value of the status byte that is required in order for the on state to be assumed. For example, if bits 0 and 1 of the attribute must be set, then a bitvalue of 3 should be specified. Most of the time the bitvalue would be a power of 2 as most of the time a single bit is indicating a status. However, there are limited circumstances where more than one bit is relevant. For the programmers: The gauge is put into the on state if the bitwise AND of the attribute’s value and the bitvalue produces a value equal to bitvalue. Although bitvalue is mandatory, it is ignored if boolean_script is specified.
attribute Yes String The name of the attribute you want to use to define the on/off status of the gauge. For example, in Speeduino there is a “status1” value which contains bits that signal key information such as whether fuel is currently being cut by DFCO.
colours Yes String Defines the colour information. This is only used when there are no bitmaps specified. See colour definitions for more information.
visible No Integer 1 or 0 Defines whether the gauge is initially visible
flashfrequency No Integer Defines the number of milliseconds between flashes if you want the gauge to flash when it is in the ‘on’ state.
onbitmap No String Specifies the name of the bitmap to be drawn when the gauge is in the on state. This setting has two optional attributes: xdelta and ydelta. These two attributes allow the position of the on bitmap to be adjusted slightly in relation to the x and y location of the gauge. This might be required if the on and off bitmaps are not the same size. See the example for how they are specified.
offbitmap No String Specifies the name of the bitmap to be drawn when the gauge is in the off state. This setting has two optional attributes: xdelta and ydelta. These two attributes allow the position of the off bitmap to be adjusted slightly in relation to the x and y location of the gauge. This might be required if the on and off bitmaps are not the same size. See the example for how they are specified.
boolean_script No String Specifies a script that will be executed in preference to using the bitvalue and the attribute. The script must return a boolean result which in turn will determine whether the gauge goes into the on or off state.
flash_script No String Specifies a script that will be executed in preference to the flashfrequency setting. The result of the script will determine the flash frequency that will be used when the gauge is in the on state.
soundfile No String Not currently in use.
sounddelay No Integer Not currently in use.
xscale No Floating Point Enables the on and off bitmaps to be scaled horizontally. Values less than 1 will make the gauge smaller. Values greater than 1 will make it larger (e.g. 2.0 is twice the size)
yscale No Floating Point Enables the on and off bitmaps to be scaled vertically. Values less than 1 will make the gauge smaller. Values greater than 1 will make it larger (e.g. 2.0 is twice the size)
threshold No Integer Specifies a simplistic value which determines if the gauge is on. This setting is ignored if a boolean script is present. When used, assuming there is no boolean script, if the attribute’s value is greater than or equal to the defined threshold value, then the boolean gauge will be considered to be on (same as returning True from the boolean script). This attribute takes precendence over the bitvalue attribute
thresholdflash No Integer Specifies a simplistic flash control, which can be used instead of a flash script. The flash script is used if defined, but otherwise if the thresholdflash is non-zero then the gauge will flash if the attribute’s value is greater than or equal to the thresholdflash value. The flash rate is defined by the flashfrequency value. Note that if this attribute is zero and the flashfrequency is non-zero (or there is a flash script) then the gauge will always flash in the on scenario, however the on value is determined (boolean script, threshold, or bitvalue). You might want this for an direction indicator for example, using just the bitvalue attribute.