Customvaluegauge
Custom expression gauge

Subpage of Gauges

Custom expression gauge

With the Custom expression gauge you can display multiple values (or expressions) on one gauge, like this:

You are not allowed to change the symbol to show like normally, but you have to write your own expression in 'C-style'. Do not worry if you are not familiar with the C programming language, this help provides all the information you need.

Right-click on the gauge and click on Change gauge text and format menu to open the editor.



You can set the following values of the gauge:
  • the title of the gauge (e.g. Custom expressions)
  • the size and the position of the title (The color is determined by the theme, it can not be changed here)
  • the size and color of the expression
  • and perhaps you can set the expression

If you know the printf("format",...) function you may go to examples (But it is recommended to go through the next section quickly because not all the formatters supported by printf are supported by the gauge!)

The expression editor
The expression editor provides so-called code-completition. It means you do not have to know the exact name of a symbol, if you type min. 3 characters, the editor will show a list filled with the symbols that start with the letters you have typed in.
If you press Ctrl-Space you will see the list of all available symbols.

In the editor you must use the following format:

"format", arg1, ..., argn
On the gauge a sequence of data formatted as the format argument specifies will be displayed.
After the format parameter, at least as many additional arguments as specified in format is expected.
Important: the format parameter must be between quotes!
argn may be a constant value (e.g. 2000) or a symbol (e.g. rpm) or an expression
expression is a combination of constant values, symbols, operators and functions (e.g. 1.5 * lambda, lambda / lambdatarget, sin(0.5 * pi))

The format argument tells what to display and how to display, it is a string that contains the text to be written out.
It can optionally contain embedded format tags that are substituted by the values specified in subsequent argument(s) and formatted as requested.
The number of arguments following the format parameters should at least be as much as the number of format tags.
The format tags follow this prototype:
%[flags][width][.precision][length]specifier
specifiermeaningexample
cCharactera
i or dSigned integer-42
fDecimal floating point3.1415
oUnsigned octal777
uUnsigned decimal integer12345
xUnsigned hexadecimal integer4f
XUnsigned hexadecimal integer (capital letters)FFA
%Display %%

The tag can also contain flags, width, .precision and modifiers sub-specifiers, which are optional and follow these specifications:

flagsmeaning
-Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
0Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier).


widthmeaning
(number)Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.


precisionmeaning
.numberdescription .number For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
For f specifier: this is the number of digits to be printed after the decimal point.
For c type: it has no effect.
When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.


lengthmeaning
hThe argument is interpreted as a short int or unsigned short int (only applies to integer specifiers: i, d, o, u, x and X).
lThe argument is interpreted as a long int or unsigned long int for integer specifiers (i, d, o, u, x and X), and as a wide character for specifier c
LThe argument is interpreted as a long double (only applies to floating point specifier f)


Only these formatters are supported!

The backslash (\) character is an 'escaper' character. You need escaping if you want display quote ("), new-line or backslash on the gauge.
Write thisTo get
\\\
\""
\n(linebreak)

Only these characters can be escaped!

Examples
InputA possible outputRemarks
"GPS Date: %d-%02d-%02d", gpsDateY + 2000, gpsDateM, gpsDateDGPS Date: 2011-04-01-
"GPS Date: %d-%d-%d", gpsDateY, gpsDateM, gpsDateDGPS Date: 11-4-1-
"RPM = %d", rpmRPM = 2676RPM is integer
"Lambda = %.01f", lambdaLambda = 1.0We need the fraction too
"Lambda = %.02f", lambdaLambda = 1.04We need bigger precision
"Lambda is equal\nto lambdatarget?\n%d", lambda == lambdatargetLambda is equal
to lambdatarget?
0
If equal it displays 1, otherwise 0
"lambdadiff = %.2f", lambda - lambdatargetlambdadiff = -0.05-
"egoCorr VE = %.2f", (veCurr * egoCorrection * lambda) / (lambdatarget * 100)egoCorr VE = 124.55-