Skip to content

Commit 5fbe7c1

Browse files
committed
upgrades and Variables fixes
1 parent 645395e commit 5fbe7c1

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

TF Parameters-1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ OK prminfo 102 "MIXER:Current/St/PanMode" 2 0 0 1 0 "" integer any r 1
106106
-- prminfo 105 "MIXER:Current/St/Role" 2 0 0 7 0 "" binary any r 1
107107
OK prminfo 106 "MIXER:Current/FxRtnCh/Label/Category" 4 0 0 6 0 "" binary any r 1
108108
OK prminfo 107 "MIXER:Current/MuteMaster/Label/Name" 6 0 0 8 "MUTE 1" "" string any r 1
109-
OK scninfo 1000 "MIXER:Lib/Bank/Scene" 1 2 0 100 0 "" integer any rw 1
109+
OK scninfo 1000 "MIXER:Lib/Bank/Scene/Recall" 1 2 0 100 0 "" integer any rw 1
110110
OK scninfo 1001 "MIXER:Lib/Scene/RecallInc" 0 0 0 0 0 "" string any rw 1
111111
OK scninfo 1002 "MIXER:Lib/Scene/RecallDec" 0 0 0 0 0 "" string any rw 1

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class instance extends InstanceBase {
340340
return data
341341
}
342342

343-
if (cmd.Address.startsWith('MIXER:Lib/Scene')) return
343+
if (cmd.Address.startsWith('MIXER:Lib')) return
344344

345345
if (this.reqStack.length == 0) {
346346
this.reqStack.push({Address: cmd.Address, X: cmd.options.X, Y: cmd.options.Y})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@companion-module/tools": "^1.0.0"
2121
},
2222
"dependencies": {
23-
"@companion-module/base": "~1.2.0"
23+
"@companion-module/base": "~1.2.1"
2424
},
2525
"prettier": "@companion-module/tools/.prettierrc.json"
2626
}

upgrade.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,52 +41,53 @@ module.exports = [
4141
}
4242

4343
console.log('Yamaha-RCP Upgrade: Config Ok, Getting Parameters...')
44-
4544
var rcpCommands = paramFuncs.getParams({config: context.currentConfig})
46-
4745
console.log('\n')
4846

4947
let checkUpgrade = (action, isAction) => {
50-
//console.log('Yamaha-RCP Upgrade: Checking action/feedback: ', action)
48+
console.log('Yamaha-RCP Upgrade: Checking action/feedback: ', action)
5149

50+
let changed = false
5251
let rcpCmd = undefined
52+
let newAction = JSON.parse(JSON.stringify(action))
5353
let actionAddress = isAction ? action.actionId : action.feedbackId
5454

55+
if (actionAddress.startsWith('MIXER_Lib')) {
56+
actionAddress = 'MIXER_Lib/Scene/Recall'
57+
newAction.options.Val = action.options.X
58+
newAction.options.X = 0
59+
changed = true
60+
}
61+
62+
if (actionAddress.startsWith('scene')) {
63+
actionAddress = 'MIXER_Lib/Bank/Scene/Recall'
64+
newAction.options.Val = action.options.X
65+
newAction.options.X = 0
66+
newAction.options.Y = action.options.Y == 'a' ? 1 : 2
67+
}
68+
5569
rcpCmd = rcpCommands.find((i) => i.Address.replace(/:/g, '_') == actionAddress)
5670
//console.log('Yamaha-RCP Upgrade: rcpCmd:', rcpCmd)
5771

5872
if (rcpCmd !== undefined) {
59-
let newAction = JSON.parse(JSON.stringify(action))
60-
let changed = false
61-
62-
switch (actionAddress) {
63-
case 'MIXER_Lib/Scene': {
64-
if (isAction) {
65-
newAction.actionId = 'MIXER_Lib/Scene/Recall'
66-
} else {
67-
newAction.feedbackId = 'MIXER_Lib/Scene/Recall'
68-
}
69-
newAction.options.Val = action.options.X
70-
newAction.options.X = 0
71-
changed = true
72-
}
73-
}
7473

7574
if (rcpCmd.Type == 'integer' || rcpCmd.Type == 'binary') {
76-
newAction.options.Val = action.options.Val == rcpCmd.Min ? '-Inf' : action.options.Val / rcpCmd.Scale
75+
newAction.options.Val = newAction.options.Val == rcpCmd.Min ? '-Inf' : newAction.options.Val / rcpCmd.Scale
7776
changed = true
7877
}
7978

8079
if (changed) {
81-
console.log(`Yamaha-RCP Upgrade: Updating ${isAction ? "Action '" + actionAddress + "' -> '" + newAction.actionId : "Feedback '" + actionAddress + "' -> '" + newAction.feedbackId}' ...`)
80+
console.log(`Yamaha-RCP Upgrade: Updating ${isAction ? "Action '" + newAction.actionId + "' -> '" + actionAddress : "Feedback '" + newAction.feedbackId + "' -> '" + actionAddress}' ...`)
8281
console.log(`X: ${action.options.X} -> ${newAction.options.X}, Y: ${action.options.Y} -> ${newAction.options.Y}, Val: ${action.options.Val} -> ${newAction.options.Val}\n`)
8382

84-
/* if (isAction) {
83+
if (isAction) {
84+
newAction.actionId = actionAddress
8585
updates.updatedActions.push(newAction)
8686
} else {
87+
newAction.feedbackId = actionAddress
8788
updates.updatedFeedbacks.push(newAction)
8889
}
89-
*/ }
90+
}
9091

9192
return
9293
}

variables.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,19 @@ module.exports = {
6060
case 'ssrecall_ex':
6161
break
6262
case 'sscurrent_ex':
63-
instance.setVariableValues({ curScene: msg.X })
6463
// Request Current Scene Info once we know what scene we have
65-
let infoMsg = (instance.config.model == "TF") ? `${msg.X} ${msg.Y}` : msg.X
66-
instance.sendCmd(`ssinfo_ex MIXER:Lib/Scene ${infoMsg}`)
64+
if (instance.config.model == 'TF') {
65+
instance.setVariableValues({ curScene: `${ msg.Address.toUpperCase().slice(-1) }${ msg.X.toString().padStart(2, "0") }`})
66+
instance.sendCmd(`ssinfo_ex ${msg.Address} ${msg.X }`)
67+
} else {
68+
instance.setVariableValues({ curScene: msg.X })
69+
instance.sendCmd(`ssinfo_ex MIXER:Lib/Scene ${msg.X }`)
70+
}
6771
break
6872
case 'sscurrentt_ex':
6973
instance.setVariableValues({ curScene: msg.X })
7074
// Request Current Scene Info once we know what scene we have
71-
instance.sendCmd(`ssinfot_ex MIXER:Lib/Scene "${msg.X}"`)
75+
instance.sendCmd(`ssinfot_ex MIXER:Lib/Scene "${ msg.X }"`)
7276
break
7377
case 'ssinfo_ex':
7478
case 'ssinfot_ex':
@@ -128,12 +132,6 @@ module.exports = {
128132
let varToAdd = { variableId: varName, name: varName }
129133
let varIndex = instance.variables.findIndex((i) => i.variableId === varToAdd.variableId)
130134

131-
/* // Remove
132-
if (!cmd.options.createVariable && varIndex != -1) {
133-
instance.variables.splice(varIndex, 1)
134-
instance.setVariableDefinitions(instance.variables)
135-
}
136-
*/
137135
// Add
138136
if (cmd.options.createVariable) {
139137
if (varIndex == -1) {

0 commit comments

Comments
 (0)