Updated distance in measurement helper so its a settable compoment. See example.js file in measurement helper folder

This commit is contained in:
znetsixe
2025-10-05 09:34:00 +02:00
parent d99561fa80
commit de0b947c56
5 changed files with 348 additions and 274 deletions

View File

@@ -5,7 +5,7 @@ class ChildRegistrationUtils {
this.registeredChildren = new Map();
}
async registerChild(child, positionVsParent) {
async registerChild(child, positionVsParent, distance) {
const { softwareType } = child.config.functionality;
const { name, id } = child.config.general;
@@ -13,7 +13,7 @@ class ChildRegistrationUtils {
// Enhanced child setup
child.parent = this.mainClass;
//child.positionVsParent = positionVsParent;
child.positionVsParent = positionVsParent;
// Enhanced measurement container with rich context
if (child.measurements) {
@@ -33,10 +33,10 @@ class ChildRegistrationUtils {
registeredAt: Date.now()
});
this.logger.debug(`Child ${name} stored under type ${softwareType}`);
this.logger.debug(`Spitting out mainclass: ${this.mainClass.child} `);
// IMPORTANT: Only call parent registration - no automatic handling and if parent has this function then try to register this child
if (typeof this.mainClass.registerChild === 'function') {
this.mainClass.registerChild(child, softwareType);
}
this.logger.info(`✅ Child ${name} registered successfully`);
}