(2017-05-31, 11:50 AM)holgerw Wrote: Hello
good Solution to input/patch the NMEA Data.
But another Thing about KPLEX Config:
Why do we allways get these system_a and system_b ports with default.
Both were INPUTS and get DATA from the same UDP-in Port 10110.
In my Opinion one is obsolete.
Not sure and don't know enough to consider going near the delete button.....
One last thing, when node red was outputting to address = "localhost" , the address in openplotter nmea tab seemed to ned to be blank to accept the data, I've changed node red to send to address "10.10.10.1" , with openplotter set to look there it seems to work OK.
And another tip - if you want to quickly see whats coming in a port you can use this in a terminal..
netcat -ul 10108
(port 10108)
And a quick node-red flow which creates a new NMEA message which opencpn dashboard recognises and will automatically ut into the logbook konni. Note - you need to have an input on 10.10.10.1:10108 in the nmea tab for this to work. Ta
Code:
[
{
"id": "a40d315e.6d623",
"type": "udp in",
"z": "dcf0a43.0c79158",
"name": "",
"iface": "",
"port": "10110",
"ipv": "udp4",
"multicast": "false",
"group": "",
"datatype": "utf8",
"x": 220,
"y": 520,
"wires": [
[
"983684db.178fa8",
"4bdefe26.a6557"
]
]
},
{
"id": "8f7e9341.ce0e1",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "",
"active": false,
"console": "false",
"complete": "false",
"x": 1090,
"y": 500,
"wires": []
},
{
"id": "4bdefe26.a6557",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "",
"active": false,
"console": "false",
"complete": "false",
"x": 390,
"y": 600,
"wires": []
},
{
"id": "983684db.178fa8",
"type": "switch",
"z": "dcf0a43.0c79158",
"name": "Filter just pressure",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "OCMDA*",
"vt": "str",
"case": true
}
],
"checkall": "true",
"outputs": 1,
"x": 430,
"y": 520,
"wires": [
[
"85be98e1.ebdaf8"
]
]
},
{
"id": "85be98e1.ebdaf8",
"type": "function",
"z": "dcf0a43.0c79158",
"name": "Strip '$OC\"",
"func": "var nmeaFull=msg.payload;\n\nvar nmea=nmeaFull.substring(6 ); //\nnmea = '$WIMDA' + nmea;\n\n\nmsg.payload = nmea;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 610,
"y": 520,
"wires": [
[
"15037269.71db2e"
]
]
},
{
"id": "f276f15e.2e3c6",
"type": "udp out",
"z": "dcf0a43.0c79158",
"name": "",
"addr": "10.10.10.1",
"iface": "",
"port": "10108",
"ipv": "udp4",
"outport": "",
"base64": false,
"multicast": "false",
"x": 1120,
"y": 560,
"wires": []
},
{
"id": "5d7d539b.4836dc",
"type": "function",
"z": "dcf0a43.0c79158",
"name": "calc checksum",
"func": "var nmea = msg.payload;\nvar checksum = 0; \n\nfor(var i = 0; i < nmea.length; i++) { \n checksum = checksum ^ nmea.charCodeAt(i); \n}\nchecksum = checksum.toString(16); //convert to hex\nnmea = '$' + nmea + '*' + checksum; //make the full nmea sentence again\n\nmessage = 'Full message =' + nmea + '\\r\\n' + 'Checksum = ' + checksum ;\n\nmsg.payload = nmea;\nmsg.payload = msg.payload+\"\\r\\n\"\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 840,
"y": 600,
"wires": [
[
"8f7e9341.ce0e1",
"f276f15e.2e3c6"
]
]
},
{
"id": "15037269.71db2e",
"type": "function",
"z": "dcf0a43.0c79158",
"name": "Strip front and back",
"func": "var nmeaFull=msg.payload;\n\nvar nmeaStripped=nmeaFull.substring(1, nmeaFull.indexOf(\"*\")); //cut of the leading \"$\" and the bad checksum\nmsg.payload = nmeaStripped;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 820,
"y": 500,
"wires": [
[
"5d7d539b.4836dc"
]
]
}
]