From 3fc8dbefe811ea0663a56dca158ee11568aba000 Mon Sep 17 00:00:00 2001 From: znetsixe <73483679+znetsixe@users.noreply.github.com> Date: Wed, 2 Jul 2025 17:07:19 +0200 Subject: [PATCH] bug fix --- src/nodeClass.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/nodeClass.js b/src/nodeClass.js index 235bf2c..f41b025 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -20,12 +20,13 @@ class nodeClass { this.RED = RED; // This is the Node-RED runtime API, we can use this to create endpoints if needed this.name = nameOfNode; // This is the name of the node, it should match the file name and the node type in Node-RED this.source = null; // Will hold the specific class instance + this.config = null; // Will hold the merged configuration // Load default & UI config this._loadConfig(uiConfig,this.node); // Instantiate core Measurement class - this._setupSpecificClass(); + this._setupSpecificClass(uiConfig); // Wire up event and lifecycle handlers this._bindEvents(); @@ -40,8 +41,6 @@ class nodeClass { * @param {object} uiConfig - Raw config from Node-RED UI. */ _loadConfig(uiConfig,node) { - const cfgMgr = new configManager(); - this.defaultConfig = cfgMgr.getConfig(this.name); // Merge UI config over defaults this.config = { @@ -75,7 +74,7 @@ class nodeClass { /** * Instantiate the core Measurement logic and store as source. */ - _setupSpecificClass() { + _setupSpecificClass(uiConfig) { const machineConfig = this.config; // need extra state for this @@ -87,13 +86,13 @@ class nodeClass { } }, movement: { - speed: Number(machineConfig.speed) + speed: Number(uiConfig.speed) }, time: { - starting: Number(machineConfig.startup), - warmingup: Number(machineConfig.warmup), - stopping: Number(machineConfig.shutdown), - coolingdown: Number(machineConfig.cooldown) + starting: Number(uiConfig.startup), + warmingup: Number(uiConfig.warmup), + stopping: Number(uiConfig.shutdown), + coolingdown: Number(uiConfig.cooldown) } };