node-zserial 1.0.29 → 1.0.30
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 +5 -4
package/package.json
CHANGED
package/zserial.js
CHANGED
|
@@ -1091,18 +1091,19 @@ module.exports = function (RED) {
|
|
|
1091
1091
|
const calcB = crc16x25(b, 1, expectedEnd - 2);
|
|
1092
1092
|
const fcsOK = (calcA === fcs) || (calcB === fcs);
|
|
1093
1093
|
|
|
1094
|
-
//
|
|
1095
|
-
//
|
|
1094
|
+
// 现场经常遇到:帧内容完整(68..16 边界正确),但 FCS 因链路噪声/串口转换器问题偶发不一致。
|
|
1095
|
+
// 若此处直接判为错误帧并 dequeue,会导致上层“偶尔无法解码”(尤其是请求-响应严格匹配的场景)。
|
|
1096
|
+
// 因此:当边界与长度域一致时,允许“容错通过”,并在 _meta 中标记 fcs_ok=false 供上层排障。
|
|
1096
1097
|
if (!fcsOK) {
|
|
1097
1098
|
return {
|
|
1098
|
-
ok:
|
|
1099
|
+
ok: true,
|
|
1099
1100
|
used: expectedEnd + 1,
|
|
1100
1101
|
frame: b.slice(0, expectedEnd + 1),
|
|
1101
1102
|
fcs_ok: false,
|
|
1102
1103
|
fcs_frame: fcs,
|
|
1103
1104
|
fcs_calc_a: calcA,
|
|
1104
1105
|
fcs_calc_b: calcB,
|
|
1105
|
-
err: "
|
|
1106
|
+
err: "698_LEN_FCS_FAIL_TOLERATED"
|
|
1106
1107
|
};
|
|
1107
1108
|
}
|
|
1108
1109
|
|