Skip to content

Commit

Permalink
Bugfix for duplicate insertation of registers
Browse files Browse the repository at this point in the history
  • Loading branch information
asimgunes committed Dec 11, 2023
1 parent 77d180e commit 7369dfd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/views/nodes/peripheralclusternode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ export class PeripheralClusterNode extends ClusterOrRegisterBaseNode {
this.parent.addChild(this);

options.clusters?.forEach((clusterOptions) => {
const cluster = new PeripheralClusterNode(this, clusterOptions);
this.addChild(cluster);
// PeripheralClusterNode constructor already adding the reference as child to parent object (PeripheralClusterNode object)
new PeripheralClusterNode(this, clusterOptions);
});

options.registers?.forEach((registerOptions) => {
const register = new PeripheralRegisterNode(this, registerOptions);
this.addChild(register);
// PeripheralRegisterNode constructor already adding the reference as child to parent object (PeripheralClusterNode object)
new PeripheralRegisterNode(this, registerOptions);
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/views/nodes/peripheralnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ export class PeripheralNode extends PeripheralBaseNode {
this.addrRanges = [];

options.clusters?.forEach((clusterOptions) => {
const cluster = new PeripheralClusterNode(this, clusterOptions);
this.addChild(cluster);
// PeripheralClusterNode constructor already adding the reference as child to parent object (PeripheralNode object)
new PeripheralClusterNode(this, clusterOptions);
});

options.registers?.forEach((registerOptions) => {
const register = new PeripheralRegisterNode(this, registerOptions);
this.addChild(register);
// PeripheralRegisterNode constructor already adding the reference as child to parent object (PeripheralNode object)
new PeripheralRegisterNode(this, registerOptions);
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/views/nodes/peripheralregisternode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class PeripheralRegisterNode extends ClusterOrRegisterBaseNode {
this.parent.addChild(this);

options.fields?.forEach((fieldOptions) => {
this.addChild(new PeripheralFieldNode(this, fieldOptions));
// PeripheralFieldNode constructor already adding the reference as child to parent object (PeripheralRegisterNode object)
new PeripheralFieldNode(this, fieldOptions);
});
}

Expand Down

0 comments on commit 7369dfd

Please sign in to comment.