更新 main.js

master
钟进 6 years ago
parent fd6f66f5cb
commit c451c36934

@ -345,6 +345,7 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects)
regs[i].fullId = id; regs[i].fullId = id;
objects[id] = { objects[id] = {
_id: regs[i].id, _id: regs[i].id,
type: 'state', type: 'state',
@ -363,28 +364,26 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects)
deviceId: regs[i].deviceId deviceId: regs[i].deviceId
} }
}; };
if (regType === 'inputRegs' || regType === 'holdingRegs') {
objects[id].common.unit = regs[i].unit || '';
objects[id].common.unit = regs[i].unit || '';
objects[id].native.type = regs[i].type; objects[id].native.type = regs[i].type;
objects[id].native.len = regs[i].len; objects[id].native.len = regs[i].len;
objects[id].native.offset = regs[i].offset; objects[id].native.offset = regs[i].offset;
objects[id].native.factor = regs[i].factor; objects[id].native.factor = regs[i].factor;
if (regType === 'holdingRegs') {
objects[id].native.poll = regs[i].poll; objects[id].native.poll = regs[i].poll;
}
}
tasks.push({ tasks.push({
id: regs[i].id, id: regs[i].id,
name: 'add', name: 'add',
obj: objects[id] obj: objects[id]
}); });
tasks.push({ tasks.push({
id: id, id: id,
name: 'syncEnums', name: 'syncEnums',
obj: regs[i].room obj: regs[i].room
}); });
newObjects.push(id); newObjects.push(id);
} }

Loading…
Cancel
Save