@ray-js/lamp-schedule-core 1.0.5-beta.4 → 1.0.5-beta.6
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.
|
@@ -75,10 +75,13 @@ export class SleepSigmesh {
|
|
|
75
75
|
var _data$nodes$length, _data$nodes;
|
|
76
76
|
scheduleLogger.debug('Sigmesh dpParser ===> SleepSigmesh formatter: data', data);
|
|
77
77
|
// dataMode 可能是字符串 ('01'/'02'/'03') 或数字 (1/2/3)
|
|
78
|
-
|
|
79
|
-
// 使用 nodes.length 而非 data.length,因为调用方可能未更新 length 字段
|
|
78
|
+
typeof data.dataMode === 'string' ? parseInt(data.dataMode, 10) : data.dataMode; // 使用 nodes.length 而非 data.length,因为调用方可能未更新 length 字段
|
|
80
79
|
const nodeCount = (_data$nodes$length = (_data$nodes = data.nodes) === null || _data$nodes === void 0 ? void 0 : _data$nodes.length) !== null && _data$nodes$length !== void 0 ? _data$nodes$length : data.length;
|
|
81
|
-
|
|
80
|
+
// 版本号固定为 1, 与文档不一致,文档有问题
|
|
81
|
+
|
|
82
|
+
const result = [numToHexString(1), numToHexString(1),
|
|
83
|
+
// 数据模式固定为 1 也就是只支持白光,0x01:仅含BT 0x02:仅含HSV 0x03:含HSVBT
|
|
84
|
+
numToHexString(nodeCount)];
|
|
82
85
|
data.nodes.forEach(node => {
|
|
83
86
|
var _node$loops;
|
|
84
87
|
result.push(numToHexString(node.onOff ? 1 : 0), numToHexString(parseInt(node === null || node === void 0 || (_node$loops = node.loops) === null || _node$loops === void 0 || (_node$loops = _node$loops.split('')) === null || _node$loops === void 0 || (_node$loops = _node$loops.reverse()) === null || _node$loops === void 0 ? void 0 : _node$loops.join(''), 2)), numToHexString(node.step), numToHexString(node.hour), numToHexString(node.minute), numToHexString(node.brightness), numToHexString(node.temperature));
|
|
@@ -72,7 +72,9 @@ export class WakeUpSigmesh {
|
|
|
72
72
|
const dataModeNum = typeof data.dataMode === 'string' ? parseInt(data.dataMode, 10) : data.dataMode;
|
|
73
73
|
// 使用 nodes.length 而非 data.length,因为调用方可能未更新 length 字段
|
|
74
74
|
const nodeCount = (_data$nodes = data.nodes) === null || _data$nodes === void 0 ? void 0 : _data$nodes.length;
|
|
75
|
-
|
|
75
|
+
// 版本号固定为 1, 与文档不一致,文档有问题
|
|
76
|
+
|
|
77
|
+
const result = [numToHexString(1), numToHexString(dataModeNum), numToHexString(nodeCount)];
|
|
76
78
|
data.nodes.forEach(node => {
|
|
77
79
|
var _node$loops;
|
|
78
80
|
result.push(numToHexString(node.onOff ? 1 : 0), numToHexString(parseInt(node === null || node === void 0 || (_node$loops = node.loops) === null || _node$loops === void 0 || (_node$loops = _node$loops.split('')) === null || _node$loops === void 0 || (_node$loops = _node$loops.reverse()) === null || _node$loops === void 0 ? void 0 : _node$loops.join(''), 2)), numToHexString(node.step), numToHexString(node.hour), numToHexString(node.minute), numToHexString(node.brightness), numToHexString(node.temperature), numToHexString(node.duration));
|