log updates

This commit is contained in:
Rene De ren
2025-10-03 15:41:53 +02:00
parent 5357290b41
commit bc916c0165

View File

@@ -20,7 +20,7 @@
* OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
* *
* Ownership of this code remains solely with the original author. Unauthorized * Ownership of this code remainregisterChilds solely with the original author. Unauthorized
* use of this Software is strictly prohibited. * use of this Software is strictly prohibited.
* *
* @summary A class to interact and manipulate machines with a non-euclidian curve * @summary A class to interact and manipulate machines with a non-euclidian curve
@@ -120,18 +120,23 @@ class Machine {
/*------------------- Register child events -------------------*/ /*------------------- Register child events -------------------*/
registerChild(child, softwareType) { registerChild(child, softwareType) {
this.logger.debug('Setting up child event listeners'); this.logger.debug('Setting up child event for softwaretype ' + softwareType);
if(softwareType === "measurement"){ if(softwareType === "measurement"){
const position = child.config.functionality.positionVsParent; const position = child.config.functionality.positionVsParent;
const distance = child.config.functionality.distanceVsParent || 0;
const measurementType = child.config.asset.type; const measurementType = child.config.asset.type;
const key = `${measurementType}_${position}`; const key = `${measurementType}_${position}`;
//rebuild to measurementype.variant no position and then switch based on values not strings or names.
const eventName = `${measurementType}.measured.${position}`; const eventName = `${measurementType}.measured.${position}`;
this.logger.debug(`Setting up listener for ${eventName} from child ${child.config.general.name}`);
// Register event listener for measurement updates // Register event listener for measurement updates
child.measurements.emitter.on(eventName, (eventData) => { child.measurements.emitter.on(eventName, (eventData) => {
this.logger.debug(`🔄 ${position} ${measurementType} from ${eventData.childName}: ${eventData.value} ${eventData.unit}`); this.logger.debug(`🔄 ${position} ${measurementType} from ${eventData.childName}: ${eventData.value} ${eventData.unit}`);
console.log(` Emitting... ${eventName} with data:`);
// Store directly in parent's measurement container // Store directly in parent's measurement container
this.measurements this.measurements
.type(measurementType) .type(measurementType)