Update main.js
This commit is contained in:
parent
2dea08a96a
commit
e4eba580d9
34
main.js
34
main.js
@ -228,10 +228,11 @@ function prepareConfig(config) {
|
||||
}
|
||||
|
||||
let deviceIds = [];
|
||||
checkDeviceIds(options, config.disInputs, deviceIds);
|
||||
checkDeviceIds(options, config.coils, deviceIds);
|
||||
checkDeviceIds(options, config.inputRegs, deviceIds);
|
||||
checkDeviceIds(options, config.holdingRegs, deviceIds);
|
||||
|
||||
//checkDeviceIds(options, config.disInputs, deviceIds);
|
||||
//checkDeviceIds(options, config.coils, deviceIds);
|
||||
//checkDeviceIds(options, config.inputRegs, deviceIds);
|
||||
//checkDeviceIds(options, config.holdingRegs, deviceIds);
|
||||
deviceIds.sort();
|
||||
|
||||
// settings for master
|
||||
@ -249,15 +250,7 @@ function prepareConfig(config) {
|
||||
port: parseInt(params.port, 10) || 502,
|
||||
bind: params.bind
|
||||
};
|
||||
} else {
|
||||
options.config.serial = {
|
||||
comName: params.comName,
|
||||
baudRate: params.baudRate,
|
||||
dataBits: params.dataBits,
|
||||
stopBits: params.stopBits,
|
||||
parity: params.parity
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (let d = 0; d < deviceIds.length; d++) {
|
||||
let deviceId = deviceIds[d];
|
||||
@ -427,15 +420,7 @@ function checkObjects(options, regType, regName, regFullName, tasks, newObjects)
|
||||
}
|
||||
}
|
||||
|
||||
// localOptions = {
|
||||
// multiDeviceId
|
||||
// showAliases
|
||||
// doNotRoundAddressToWord
|
||||
// directAddresses
|
||||
// isSlave
|
||||
// maxBlock
|
||||
// maxBoolBlock
|
||||
// };
|
||||
|
||||
function iterateAddresses(isBools, deviceId, result, regName, regType, localOptions) {
|
||||
const config = result.config;
|
||||
if (config && config.length) {
|
||||
@ -551,9 +536,14 @@ function iterateAddresses(isBools, deviceId, result, regName, regType, localOpti
|
||||
}
|
||||
|
||||
function parseConfig(callback) {
|
||||
|
||||
adapter.log.warn('adapter.config=' + adapter.config);
|
||||
|
||||
let options = prepareConfig(adapter.config);
|
||||
const params = adapter.config.params;
|
||||
|
||||
adapter.log.warn('options=' + options);
|
||||
|
||||
const localOptions = {
|
||||
multiDeviceId: options.config.multiDeviceId,
|
||||
showAliases: (params.showAliases === true || params.showAliases === 'true'),
|
||||
|
Loading…
Reference in New Issue
Block a user