and honour text (utf8) mode in single char mode. aaargh.

This commit is contained in:
Dave C-J 2014-06-08 15:27:15 +01:00
parent 12b8fa36dc
commit 7d6f70545a
1 changed files with 2 additions and 1 deletions

View File

@ -118,7 +118,8 @@ module.exports = function(RED) {
this.port.on('data', function(msg) {
// single char buffer
if ((node.serialConfig.newline == 0)||(node.serialConfig.newline == "")) {
node.send({"payload": new Buffer([msg])});
if (node.serialConfig.bin !== "bin") { node.send({"payload": String.fromCharCode(msg)}); }
else { node.send({"payload": new Buffer([msg])}); }
}
else {
// do the timer thing