In presets, ignore config parameters that don't exist in the device

This commit is contained in:
Zaid Abdulla committed 2013-01-15 16:34:18 +03:00
1 parent 77d1c86b86
commit cd67e50062
2 files changed
+4

No files matched your search

+3
View File
@@ -38,9 +38,12 @@ exports.extend = (obj, mixin) ->
exports.getParamValueFromPath = (obj, path) -> exports.getParamValueFromPath = (obj, path) ->
pp = path.split('.') pp = path.split('.')
ref = obj ref = obj
try
for p in pp for p in pp
ref = ref[p] ref = ref[p]
return ref return ref
catch err
return undefined
exports.matchType = (src, dst) -> exports.matchType = (src, dst) ->
+1
View File
@@ -73,6 +73,7 @@ exports.assertPresets = (deviceId, presetsHash, callback) ->
switch c.type switch c.type
when 'value' when 'value'
src = common.getParamValueFromPath(device, "#{c.name}._value") src = common.getParamValueFromPath(device, "#{c.name}._value")
if src isnt undefined # ignore parameters that don't exist
dst = common.matchType(src, c.value) dst = common.matchType(src, c.value)
if src != dst if src != dst
setParameterValues.push([c.name, dst]) setParameterValues.push([c.name, dst])