This commit is contained in:
znetsixe
2025-07-02 17:07:19 +02:00
parent f24a5fb90b
commit 3fc8dbefe8

View File

@@ -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.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.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.source = null; // Will hold the specific class instance
this.config = null; // Will hold the merged configuration
// Load default & UI config // Load default & UI config
this._loadConfig(uiConfig,this.node); this._loadConfig(uiConfig,this.node);
// Instantiate core Measurement class // Instantiate core Measurement class
this._setupSpecificClass(); this._setupSpecificClass(uiConfig);
// Wire up event and lifecycle handlers // Wire up event and lifecycle handlers
this._bindEvents(); this._bindEvents();
@@ -40,8 +41,6 @@ class nodeClass {
* @param {object} uiConfig - Raw config from Node-RED UI. * @param {object} uiConfig - Raw config from Node-RED UI.
*/ */
_loadConfig(uiConfig,node) { _loadConfig(uiConfig,node) {
const cfgMgr = new configManager();
this.defaultConfig = cfgMgr.getConfig(this.name);
// Merge UI config over defaults // Merge UI config over defaults
this.config = { this.config = {
@@ -75,7 +74,7 @@ class nodeClass {
/** /**
* Instantiate the core Measurement logic and store as source. * Instantiate the core Measurement logic and store as source.
*/ */
_setupSpecificClass() { _setupSpecificClass(uiConfig) {
const machineConfig = this.config; const machineConfig = this.config;
// need extra state for this // need extra state for this
@@ -87,13 +86,13 @@ class nodeClass {
} }
}, },
movement: { movement: {
speed: Number(machineConfig.speed) speed: Number(uiConfig.speed)
}, },
time: { time: {
starting: Number(machineConfig.startup), starting: Number(uiConfig.startup),
warmingup: Number(machineConfig.warmup), warmingup: Number(uiConfig.warmup),
stopping: Number(machineConfig.shutdown), stopping: Number(uiConfig.shutdown),
coolingdown: Number(machineConfig.cooldown) coolingdown: Number(uiConfig.cooldown)
} }
}; };