In presets, ignore config parameters that don't exist in the device
This commit is contained in:
1 parent
77d1c86b86
commit
cd67e50062
2 files changed
+4
No files matched your search
@@ -38,9 +38,12 @@ exports.extend = (obj, mixin) ->
|
||||
exports.getParamValueFromPath = (obj, path) ->
|
||||
pp = path.split('.')
|
||||
ref = obj
|
||||
try
|
||||
for p in pp
|
||||
ref = ref[p]
|
||||
return ref
|
||||
catch err
|
||||
return undefined
|
||||
|
||||
|
||||
exports.matchType = (src, dst) ->
|
||||
|
||||
@@ -73,6 +73,7 @@ exports.assertPresets = (deviceId, presetsHash, callback) ->
|
||||
switch c.type
|
||||
when 'value'
|
||||
src = common.getParamValueFromPath(device, "#{c.name}._value")
|
||||
if src isnt undefined # ignore parameters that don't exist
|
||||
dst = common.matchType(src, c.value)
|
||||
if src != dst
|
||||
setParameterValues.push([c.name, dst])
|
||||
|
||||
Reference in new issue
Block a user