@ray-js/lamp-schedule-core 1.0.1-beta-1 → 1.0.1-beta-2
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/lib/dpParser/rtcTimer.js +41 -14
- package/lib/types/timer.d.ts +2 -0
- package/package.json +1 -1
package/lib/dpParser/rtcTimer.js
CHANGED
|
@@ -31,6 +31,8 @@ var EDpCodes = /*#__PURE__*/function (EDpCodes) {
|
|
|
31
31
|
EDpCodes["colour_data"] = "colour_data";
|
|
32
32
|
EDpCodes["temp_value"] = "temp_value";
|
|
33
33
|
EDpCodes["switch_led"] = "switch_led";
|
|
34
|
+
EDpCodes["bright_value1"] = "bright_value1";
|
|
35
|
+
EDpCodes["temp_value1"] = "temp_value1";
|
|
34
36
|
return EDpCodes;
|
|
35
37
|
}(EDpCodes || {});
|
|
36
38
|
export class RtcTimerFormatter {
|
|
@@ -94,7 +96,7 @@ export class RtcTimerFormatter {
|
|
|
94
96
|
A=0x06,节能,
|
|
95
97
|
A=0x07,太阳能
|
|
96
98
|
*/
|
|
97
|
-
step(2).value;
|
|
99
|
+
const dataType = step(2).value;
|
|
98
100
|
let dps = {}; // 设备动作
|
|
99
101
|
// 白光模式 dp
|
|
100
102
|
if (length === brightLightLen) {
|
|
@@ -105,17 +107,31 @@ export class RtcTimerFormatter {
|
|
|
105
107
|
[EDpCodes.temp_value]: temp_value
|
|
106
108
|
};
|
|
107
109
|
} else if (length === colourLightLen) {
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
// 混光 混白光
|
|
111
|
+
if (dataType === 9) {
|
|
112
|
+
const bright_value = step(2).value;
|
|
113
|
+
const temp_value = step(2).value;
|
|
114
|
+
const bright_value1 = step(2).value;
|
|
115
|
+
const temp_value1 = step(2).value;
|
|
116
|
+
dps = {
|
|
117
|
+
[EDpCodes.bright_value]: bright_value,
|
|
118
|
+
[EDpCodes.temp_value]: temp_value,
|
|
119
|
+
[EDpCodes.bright_value1]: bright_value1,
|
|
120
|
+
[EDpCodes.temp_value1]: temp_value1
|
|
121
|
+
};
|
|
122
|
+
} else {
|
|
123
|
+
// 彩光模式dp
|
|
124
|
+
const hue = step(4).value;
|
|
125
|
+
const saturation = step(2).value;
|
|
126
|
+
const _value = step(2).value;
|
|
127
|
+
dps = {
|
|
128
|
+
[EDpCodes.colour_data]: {
|
|
129
|
+
hue,
|
|
130
|
+
saturation,
|
|
131
|
+
value: _value
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
119
135
|
} else if (length === mixLightLen) {
|
|
120
136
|
// 混光模式
|
|
121
137
|
const hue = step(4).value;
|
|
@@ -250,10 +266,21 @@ export class RtcTimerFormatter {
|
|
|
250
266
|
const saturationStr = this.to16(saturation, 2);
|
|
251
267
|
const valueStr = this.to16(value, 2);
|
|
252
268
|
dpDataStr = `03${hueStr}${saturationStr}${valueStr}`;
|
|
253
|
-
} else if (Object.keys(_dps).includes(EDpCodes.bright_value)) {
|
|
254
|
-
var _dps$EDpCodes$bright_, _dps$EDpCodes$temp_va2;
|
|
269
|
+
} else if (Object.keys(_dps).includes(EDpCodes.bright_value) && Object.keys(_dps).includes(EDpCodes.bright_value1)) {
|
|
270
|
+
var _dps$EDpCodes$bright_, _dps$EDpCodes$temp_va2, _dps$EDpCodes$bright_2, _dps$EDpCodes$temp_va3;
|
|
255
271
|
const bright_value = (_dps$EDpCodes$bright_ = _dps[EDpCodes.bright_value]) !== null && _dps$EDpCodes$bright_ !== void 0 ? _dps$EDpCodes$bright_ : 100;
|
|
256
272
|
const temp_value = (_dps$EDpCodes$temp_va2 = _dps[EDpCodes.temp_value]) !== null && _dps$EDpCodes$temp_va2 !== void 0 ? _dps$EDpCodes$temp_va2 : 0;
|
|
273
|
+
const bright_value1 = (_dps$EDpCodes$bright_2 = _dps[EDpCodes.bright_value1]) !== null && _dps$EDpCodes$bright_2 !== void 0 ? _dps$EDpCodes$bright_2 : 100;
|
|
274
|
+
const temp_value1 = (_dps$EDpCodes$temp_va3 = _dps[EDpCodes.temp_value1]) !== null && _dps$EDpCodes$temp_va3 !== void 0 ? _dps$EDpCodes$temp_va3 : 0;
|
|
275
|
+
const brightStr = this.to16(bright_value, 2);
|
|
276
|
+
const temperatureStr = this.to16(temp_value, 2);
|
|
277
|
+
const brightStr1 = this.to16(bright_value1, 2);
|
|
278
|
+
const temperatureStr1 = this.to16(temp_value1, 2);
|
|
279
|
+
dpDataStr = `09${brightStr}${temperatureStr}${brightStr1}${temperatureStr1}`;
|
|
280
|
+
} else if (Object.keys(_dps).includes(EDpCodes.bright_value)) {
|
|
281
|
+
var _dps$EDpCodes$bright_3, _dps$EDpCodes$temp_va4;
|
|
282
|
+
const bright_value = (_dps$EDpCodes$bright_3 = _dps[EDpCodes.bright_value]) !== null && _dps$EDpCodes$bright_3 !== void 0 ? _dps$EDpCodes$bright_3 : 100;
|
|
283
|
+
const temp_value = (_dps$EDpCodes$temp_va4 = _dps[EDpCodes.temp_value]) !== null && _dps$EDpCodes$temp_va4 !== void 0 ? _dps$EDpCodes$temp_va4 : 0;
|
|
257
284
|
const brightStr = this.to16(bright_value, 2);
|
|
258
285
|
const temperatureStr = this.to16(temp_value, 2);
|
|
259
286
|
dpDataStr = `02${brightStr}${temperatureStr}`;
|
package/lib/types/timer.d.ts
CHANGED