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.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)
}
};