Subpage of Gauges
Custom expression 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, ..., argnOn the gauge a sequence of data formatted as the format argument specifies will be displayed.
%[flags][width][.precision][length]specifier
specifier | meaning | example |
---|---|---|
c | Character | a |
i or d | Signed integer | -42 |
f | Decimal floating point | 3.1415 |
o | Unsigned octal | 777 |
u | Unsigned decimal integer | 12345 |
x | Unsigned hexadecimal integer | 4f |
X | Unsigned hexadecimal integer (capital letters) | FFA |
% | Display % | % |
flags | meaning |
---|---|
- | 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. |
0 | Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier). |
width | meaning |
---|---|
(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. |
precision | meaning |
---|---|
.number | description
.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. |
length | meaning |
---|---|
h | The argument is interpreted as a short int or unsigned short int (only applies to integer specifiers: i, d, o, u, x and X). |
l | The 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 |
L | The argument is interpreted as a long double (only applies to floating point specifier f) |
Write this | To get |
---|---|
\\ | \ |
\" | " |
\n | (linebreak) |
Input | A possible output | Remarks |
---|---|---|
"GPS Date: %d-%02d-%02d", gpsDateY + 2000, gpsDateM, gpsDateD | GPS Date: 2011-04-01 | - |
"GPS Date: %d-%d-%d", gpsDateY, gpsDateM, gpsDateD | GPS Date: 11-4-1 | - |
"RPM = %d", rpm | RPM = 2676 | RPM is integer |
"Lambda = %.01f", lambda | Lambda = 1.0 | We need the fraction too |
"Lambda = %.02f", lambda | Lambda = 1.04 | We need bigger precision |
"Lambda is equal\nto lambdatarget?\n%d", lambda == lambdatarget | Lambda is equal to lambdatarget? 0 | If equal it displays 1, otherwise 0 |
"lambdadiff = %.2f", lambda - lambdatarget | lambdadiff = -0.05 | - |
"egoCorr VE = %.2f", (veCurr * egoCorrection * lambda) / (lambdatarget * 100) | egoCorr VE = 124.55 | - |