node-zserial 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/zserial.js +10 -3
package/package.json
CHANGED
package/zserial.js
CHANGED
|
@@ -328,13 +328,17 @@ module.exports = function (RED) {
|
|
|
328
328
|
node.send([node._msg, null, null]);
|
|
329
329
|
}
|
|
330
330
|
if (err) {
|
|
331
|
+
if (err.payload) {
|
|
332
|
+
err.sendPayload = err.payload;
|
|
333
|
+
err.payload = ''
|
|
334
|
+
}
|
|
331
335
|
node.errorMsg[port] = err
|
|
332
336
|
node.send([null, node._msg, null]);
|
|
333
337
|
}
|
|
334
338
|
sendAll(done);
|
|
335
339
|
}
|
|
336
340
|
function onMsg(msg, send, done) {
|
|
337
|
-
|
|
341
|
+
|
|
338
342
|
initMsg(msg);
|
|
339
343
|
if (!msg.serialConfigs) {
|
|
340
344
|
node.error("需要配置批量配置:msg.serialConfigs");
|
|
@@ -379,6 +383,7 @@ module.exports = function (RED) {
|
|
|
379
383
|
if (isNaN(baud)) {
|
|
380
384
|
// node.error(RED._("serial.errors.badbaudrate"), msg);
|
|
381
385
|
zsend(null, {
|
|
386
|
+
...serialConfig,
|
|
382
387
|
text: RED._("serial.errors.badbaudrate")
|
|
383
388
|
}, null, curPort.serial.path, done)
|
|
384
389
|
} else {
|
|
@@ -386,7 +391,7 @@ module.exports = function (RED) {
|
|
|
386
391
|
if (err) {
|
|
387
392
|
// node.error(err);
|
|
388
393
|
zsend(null, {
|
|
389
|
-
|
|
394
|
+
...serialConfig,
|
|
390
395
|
status: "ERR_UPDATE",
|
|
391
396
|
error: err,
|
|
392
397
|
text: "更新波特率失败"
|
|
@@ -397,6 +402,7 @@ module.exports = function (RED) {
|
|
|
397
402
|
}
|
|
398
403
|
if (!serialConfig.hasOwnProperty("payload")) {
|
|
399
404
|
zsend(null, {
|
|
405
|
+
...serialConfig,
|
|
400
406
|
text: "No payload"
|
|
401
407
|
}, null, curPort.serial.path, done)
|
|
402
408
|
return;
|
|
@@ -426,6 +432,7 @@ module.exports = function (RED) {
|
|
|
426
432
|
} else {
|
|
427
433
|
curPort._retryNum = 0
|
|
428
434
|
zsend(null, {
|
|
435
|
+
...serialConfig,
|
|
429
436
|
status: "ERR_IN_QUEUE",
|
|
430
437
|
text: '串口未打开,加入消息队列失败',
|
|
431
438
|
port: curPort.serial.path
|
|
@@ -459,7 +466,7 @@ module.exports = function (RED) {
|
|
|
459
466
|
msgout.status = "ERR_TIMEOUT";
|
|
460
467
|
msgout.port = curPort.serial.path;
|
|
461
468
|
node.status({ fill: "red", shape: "ring", text: "timeout:::" + curPort.serial.path });
|
|
462
|
-
zsend(null,msgout, null, curPort.serial.path, done);
|
|
469
|
+
zsend(null, msgout, null, curPort.serial.path, done);
|
|
463
470
|
});
|
|
464
471
|
|
|
465
472
|
curPort.on('initerror', function (port, retryNum, olderr) {
|