1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Fix serialport split on hex char

to close #541
This commit is contained in:
Dave Conway-Jones 2019-05-13 13:01:36 +01:00
parent e69d65667a
commit 344d2bfdde
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 4 additions and 5 deletions

View File

@ -208,13 +208,13 @@ module.exports = function(RED) {
var splitc; // split character
// Parse the split character onto a 1-char buffer we can immediately compare against
if (newline.substr(0,2) == "0x") {
splitc = new Buffer.alloc([parseInt(newline,16)]);
splitc = new Buffer.from([newline]);
}
else {
splitc = new Buffer.from(newline.replace("\\n","\n").replace("\\r","\r").replace("\\t","\t").replace("\\e","\e").replace("\\f","\f").replace("\\0","\0")); // jshint ignore:line
}
if (addchar === true) { addchar = splitc; }
connections[id] = (function() {
var obj = {
_emitter: new events.EventEmitter(),
@ -299,7 +299,6 @@ module.exports = function(RED) {
//newline = newline.replace("\\n","\n").replace("\\r","\r");
var olderr = "";
var setupSerial = function() {
obj.serial = new serialp(port,{
baudRate: baud,
dataBits: databits,

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-serialport",
"version" : "0.8.1",
"version" : "0.8.3",
"description" : "Node-RED nodes to talk to serial ports",
"dependencies" : {
"serialport" : "^7.1.4"
"serialport" : "^7.1.5"
},
"repository" : {
"type":"git",