更新 main.js

This commit is contained in:
钟进 2019-01-16 05:47:46 +00:00
parent fd6f66f5cb
commit c451c36934

View File

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