我正在尝试列出最新的消息列表。这是Node红色。我有一个4行LCD我希望在
上显示寻呼机信息对我来说,这应该有效,但它没有,只是在最后一行显示消息而不会添加新消息
var message = [];
message.splice(4,0,msg.message);
message.splice(0,1);
msg.payload1 = message[0];
msg.payload2 = message[1];
msg.payload3 = message[2];
msg.payload4 = message[3];
return msg;
这是Node red flow
[{"id":"dd82941d.5b65c8","type":"function","z":"4cce1974.6fb398","name":"Format Pager Message","func":"var str = msg.payload;\nvar pager = str.substring(9,16);\nvar length = str.length - 2;\nvar message = str.substring(17,length);\nmsg.pager = pager;\nmsg.message = message;\nreturn msg;","outputs":1,"noerr":0,"x":311,"y":195,"wires":[["2b7dc9b1.c01356"]]},{"id":"188de5a3.ba258a","type":"rpi-lcd","z":"4cce1974.6fb398","name":"","pins":"12,7,8,25,24,23","x":1113,"y":195,"wires":[]},{"id":"f66dd00d.9b67e","type":"template","z":"4cce1974.6fb398","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"1:{{payload1}}\n2:{{payload2}}\n3:{{payload3}}\n4:{{payload4}}","x":942,"y":193,"wires":[["188de5a3.ba258a"]]},{"id":"d6971b25.349b38","type":"debug","z":"4cce1974.6fb398","name":"","active":true,"console":"false","complete":"true","x":717,"y":245,"wires":[]},{"id":"7ee7f56e.176e5c","type":"inject","z":"4cce1974.6fb398","name":"","topic":"test","payload":"0123456789abcdefgHello Worldyz","payloadType":"str","repeat":"","crontab":"","once":false,"x":115,"y":229,"wires":[["dd82941d.5b65c8"]]},{"id":"2b7dc9b1.c01356","type":"function","z":"4cce1974.6fb398","name":"Stack Messages","func":"var message = [];\n\nmessage.splice(4,0,msg.message);\nmessage.splice(0,1);\n\nmsg.payload1 = message[0];\nmsg.payload2 = message[1];\nmsg.payload3 = message[2];\nmsg.payload4 = message[3];\nreturn msg;","outputs":1,"noerr":0,"x":539,"y":194,"wires":[["f66dd00d.9b67e","d6971b25.349b38"]]}]