@@ -104,4 +104,70 @@ module.exports = [
104104
105105 return updates
106106 } ,
107+
108+ upg30xto34x = ( context , props ) => {
109+ var paramFuncs = require ( './paramFuncs' )
110+
111+ console . log ( '\nYamaha-RCP Upgrade: Running 3.x -> 3.4 Upgrade.' )
112+ var updates = {
113+ updatedConfig : props . config ,
114+ updatedActions : [ ] ,
115+ updatedFeedbacks : [ ]
116+ }
117+
118+ if ( context . currentConfig == null ) {
119+ console . log ( '\nYamaha-RCP Upgrade: NO CONFIG FOUND!\n' )
120+ return updates
121+ }
122+
123+ if ( updates . updatedConfig !== undefined && updates . updatedConfig . meterSpeed == undefined ) {
124+ updates . updatedConfig . meterSpeed = 100 ; // set default value for new configs
125+ }
126+
127+ console . log ( 'Yamaha-RCP Upgrade: Config Ok, Getting Parameters...' )
128+ rcpCommands = paramFuncs . getParams ( context , context . currentConfig )
129+ console . log ( '\n' )
130+
131+ let checkUpgrade = ( action , isAction ) => {
132+ console . log ( 'Yamaha-RCP Upgrade: Checking action/feedback: ' , action )
133+
134+ let changed = false
135+ let rcpCmd = undefined
136+ let newAction = JSON . parse ( JSON . stringify ( action ) )
137+ let actionAddress = isAction ? action . actionId : action . feedbackId
138+
139+ if ( actionAddress == 'Bar' ) {
140+ actionAddress = 'Meter'
141+ changed = true
142+ }
143+
144+
145+ if ( changed ) {
146+ console . log ( `Yamaha-RCP Upgrade: Updating ${ isAction ? "Action '" + newAction . actionId + "' -> '" + actionAddress : "Feedback '" + newAction . feedbackId + "' -> '" + actionAddress } ' ...` )
147+ console . log ( `X: ${ action . options . X } -> ${ newAction . options . X } , Y: ${ action . options . Y } -> ${ newAction . options . Y } , Val: ${ action . options . Val } -> ${ newAction . options . Val } \n` )
148+
149+ if ( isAction ) {
150+ newAction . actionId = actionAddress
151+ updates . updatedActions . push ( newAction )
152+ } else {
153+ newAction . feedbackId = actionAddress
154+ updates . updatedFeedbacks . push ( newAction )
155+ }
156+ }
157+
158+ return
159+
160+ }
161+
162+ for ( let k in props . actions ) {
163+ checkUpgrade ( props . actions [ k ] , true )
164+ }
165+
166+ for ( let k in props . feedbacks ) {
167+ checkUpgrade ( props . feedbacks [ k ] , false )
168+ }
169+
170+ return updates
171+ } ,
172+
107173]
0 commit comments