Support for user-defined NMEA data
Since version 2.75 (iOS, Android to follow), the logbook app supports the processing of the following partially non-standardized NMEA data:- Battery voltage
- Engine operating hours
- Fuel tank capacity
- Water tank capacity
- Gray water tank capacity
- Air pressure
- Engine rpm
- Air temperature
- Heeling (Roll)
- Pitch
$MXPGN,01F211,5810,02841C8A020000FF*1E
In this case, the data (hexadecimal coded) on the current fill level 841C.
Regular expression to extract the data
To extract these from the entire data set, a regular expression must be stored in the NMEA settings for the fill level of the diesel tank, which looks like this, for example:^\$MXPGN,01F211,5810,02(?<extract>[0-9ABCDEF]{4}?)[0-9ABCDEF]{10}\*..$
If you are familiar with regular expressions you don't need to read any further, for everyone else I will try to give you a very simplified explanation so that you can create rules like this yourself.
- ^\$ This is the beginning of the data set, the backslash is only necessary because the $ in regular expressions otherwise has a different function. This part must always look exactly the same!
- MXPGN,01F211,5810,02 This is a fixed part that must always look exactly the same if you need a placeholder instead of 5810, for example, because this value can change, 5180 could be replaced by [^,]* This then applies to any number (including 0) of characters except a comma, because the comma is the field separator in NMEA data records.
- (?<extract>[0-9ABCDEF]{4}?) This is the important part that extracts the value, all other data is only for identification! The characters that may be used are shown in the square brackets, As we receive hexadecimal values here, the numbers 0123456789 and A, B, C, D, E and F are permitted. The curly brackets contain the exact number of characters. In this case exactly 4 for 841C.
- [0-9ABCDEF]{10} After that there must be 10 more hexadecimal signs
- \*..$ And finally the ending, which must always look exactly like the beginning. The backslash defuses the special function that the asterisk would otherwise have in a regular expression. The asterisk is the separator at the end of the NMEA checksum. The two dots stand for any character (namely the NMEA checksum, and the dollar represents the end of the data set.
Specifying the data type
Since this data set is hexadicimal and the byte order is reversed, Hex Little Endian must be selected to convert 841C from Little Endian to Big Endian: 1C84 and then to convert this to the decimal number 7300.Multiplier (optional)
According to the manufacturer's documentation, the value 7300 must now be multiplied by 0.004 to obtain the current fill level as a percentage. However, since we want to save the fill level in liters, this must also be converted. The manual calculation would look like this as our tank is 65 liters:- 7300 * 0.004 = 29.2%
- 65 Liter * 29.2% = 18.98 Liter
- As the logbook app saves milliliters internally for fill levels, this value must be multiplied by 1000 = 18980 milliliters
So the multiplier in this case must be
2.6
!