-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuildHADefs.js
85 lines (80 loc) · 1.73 KB
/
buildHADefs.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
73
74
75
76
77
78
79
80
81
82
83
84
85
import { pad0 } from './helpers.js'
export function buildHADefs(self) {
let haActions = {}
let haFeedbacks = {}
let haVariables = []
let ppRange = [1, 4]
const mc = self.config.channels
let haChoices = []
let ppChoices = []
for (let s = 1; s <= 24; s++) {
let c = pad0(s)
let baseID = `/headamp/${c}/`
let fID = `ha_gain${c}`
let aID = fID
let vID = `ha_gain${s}`
let theID = baseID + 'gain'
self.fbToStat[fID] = theID
self.xStat[theID] = {
varID: vID,
valid: false,
trim: self.HA_CONFIG[s].trim,
fbID: fID,
//trim: 0,
polled: 0,
}
if (self.HA_CONFIG[s][mc].has) {
let haName = self.HA_CONFIG[s][mc].name + ' Gain'
haChoices.push({ id: s, label: `${s}: ${self.HA_CONFIG[s][mc].name}` })
haVariables.push({
name: haName + ' %',
variableId: vID + '_p',
})
haVariables.push({
name: haName + ' dB',
variableId: vID + '_d',
})
if (self.HA_CONFIG[s].ph) {
fID = `ha_pp${c}`
vID = `ha_pp${s}`
theID = baseID + 'phantom'
self.fbToStat[fID] = theID
self.xStat[theID] = {
varID: vID,
valid: false,
fbID: fID,
polled: 0,
pp: false,
}
haVariables.push({
name: self.HA_CONFIG[s][mc].name + ' Phantom',
variableId: vID,
})
ppChoices.push({ id: s, label: `${s}: ${self.HA_CONFIG[s][mc].name}` })
ppRange[2] = Math.max(ppRange[2], s)
}
}
}
const act = `headamp`
haActions[act] = {
headamp: {
name: `Headamp Level`,
options: [
{
type: 'dropdown',
label: 'Input',
id: 'input',
choices: haChoices,
},
{
type: 'dropdown',
label: 'Action',
id: 'act',
choices: self.levelOpts,
default: '',
},
],
},
}
self.variableDefs.push(...haVariables)
}