-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathledparts.js
72 lines (64 loc) · 3.08 KB
/
ledparts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function(e, t, a) {
'use strict';
function o(e) {
return p.writeHostToTarget(u.DistSource.MCU_MAIN, [u.L2_CMD.LED, f.KEY_LED_TABLE, e])
}
function n(e, t, a, o) {
if (36 < o.length) {
const n = 2 === e ? u.DistSource.MCU_MAIN : m,
r = `${u.sourceDist(n,u.DistSource.USB_HOST)}-${u.L2_CMD.LED}-${e}`,
i = u.sourceDist(u.DistSource.USB_HOST, n),
l = u.generateBigData(i, [u.L2_CMD.LED, e, t, a], o);
return new Promise(async (e, t) => {
try {
for (const e of l) await p.write(r, e);
e()
} catch (e) {
log.error('ledPreviewOrDownload error'), t(e)
}
})
}
return e === f.KEY_LED_ON_DL ? p.writeHostToTarget(u.DistSource.MCU_MAIN, [u.L2_CMD.LED, e, t, a].concat(o)) : p.writeHostToTarget(m, [u.L2_CMD.LED, e, t, a].concat(o))
}
function r(e) {
return p.writeHostToTarget(m, [u.L2_CMD.LED, f.KEY_LED_PRE, 255, 1].concat(e))
}
function i(e) {
return p.writeHostToTarget(m, [u.L2_CMD.LED, f.KEY_LED_AUDIO_VISUALIZE, 0, 1].concat(e))
}
function l(e) {
const t = m,
a = `${u.sourceDist(t,u.DistSource.USB_HOST)}-${u.L2_CMD.LED}-${f.KEY_LED_AUDIO_VISUALIZE}`,
o = u.sourceDist(u.DistSource.USB_HOST, t),
n = u.generateBigData(o, [u.L2_CMD.LED, f.KEY_LED_AUDIO_VISUALIZE, 0, 2], e);
return new Promise(async (e, t) => {
try {
for (const e of n) await p.write(a, e);
e()
} catch (e) {
log.error('ledPreviewOrDownload error'), t(e)
}
})
}
function d(e) {
return p.writeHostToTarget(u.DistSource.MCU_MAIN, [u.L2_CMD.LED, f.KEY_LED_HOLD_ON, e])
}
function s(e) {
return p.writeHostToTarget(u.DistSource.MCU_MAIN, [u.L2_CMD.LED, f.KEY_BACKLIGHT_BRIGHTNESS, e])
}
function c(e) {
return p.writeHostToTarget(u.DistSource.MCU_MAIN, [u.L2_CMD.LED, f.KEY_INDICATOR_BRIGHTNESS, e])
}
Object.defineProperty(t, '__esModule', {
value: !0
});
const p = a(111),
u = a(132);
let m = u.DistSource.MCU_LED;
var f;
(function(e) {
e[e.KEY_RESERVED = 0] = 'KEY_RESERVED', e[e.KEY_LED_ON_OFF = 1] = 'KEY_LED_ON_OFF', e[e.KEY_LED_ON_DL = 2] = 'KEY_LED_ON_DL', e[e.KEY_LED_PRE = 3] = 'KEY_LED_PRE', e[e.KEY_LED_TABLE = 4] = 'KEY_LED_TABLE', e[e.KEY_LED_HOLD_ON = 13] = 'KEY_LED_HOLD_ON', e[e.KEY_LED_AUDIO_VISUALIZE = 17] = 'KEY_LED_AUDIO_VISUALIZE', e[e.KEY_INDICATOR_BRIGHTNESS = 20] = 'KEY_INDICATOR_BRIGHTNESS', e[e.KEY_BACKLIGHT_BRIGHTNESS = 21] = 'KEY_BACKLIGHT_BRIGHTNESS'
})(f = t.LedKeys || (t.LedKeys = {})), t.setCmdDist = function(e) {
m = e
}, t.lightTable = o, t.ledPreviewOrDownload = n, t.previewPureLed = r, t.audioVisualizePureLed = i, t.audioVisualizeMutiLed = l, t.writeLedHold = d, t.writeBacklightBrightness = s, t.writeIndicatorBrightness = c
}