Update main.js

This commit is contained in:
Administrator 2018-11-08 10:45:28 +08:00
parent 44014f6ca0
commit 6934206d18

21
main.js
View File

@ -287,11 +287,10 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects)
common: {
name: regs[i].description,
role: regs[i].role,
type: regType === 'coils' || regType === 'disInputs' ? 'boolean' :
((regs[i].type === 'string' || regs[i].type === 'string') ? 'string' : 'number'),
type: regs[i].type,
read: true,
write: regType === 'coils' || regType === 'holdingRegs',
def: regType === 'coils' || regType === 'disInputs' ? false : 0
write: true,
def: regs[i].type === 'boolean' ? false : regs[i].value
},
native: {
regType: regType,
@ -299,21 +298,11 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects)
deviceId: regs[i].deviceId
}
};
if (regType === 'coils') {
objects[id].native.poll = regs[i].poll;
objects[id].native.wp = regs[i].wp;
} else
if (regType === 'inputRegs' || regType === 'holdingRegs') {
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,