Skip to content

[Fix] Fix address uniqueness to use IO Type and address - #484

Merged
eitch merged 4 commits into
developfrom
feature/io-already-exists
Sep 9, 2025
Merged

[Fix] Fix address uniqueness to use IO Type and address#484
eitch merged 4 commits into
developfrom
feature/io-already-exists

Conversation

@eitch

@eitch eitch commented Sep 5, 2025

Copy link
Copy Markdown
Member

This should fix the issue where a PWM and GPIO use the same address as integer, but should be possible as they are different I/Os.

Refactored `Registry` to use `IOType` for managing addresses, ensuring better segregation of address spaces between IO types. Updated related methods and internal data structures accordingly.
@Override
public synchronized boolean exists(int address) {
return usedAddresses.contains(address);
public synchronized boolean exists(IOType ioType, int address) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be unit tested?

Introduced the ability to shutdown and unregister IO instances using the instance itself, complementing the existing ID-based method. Updated related methods, tests, and documentation to reflect the new functionality.
@eitch

eitch commented Sep 5, 2025

Copy link
Copy Markdown
Member Author

@FDelporte i added tests

@FDelporte

Copy link
Copy Markdown
Member

added tests
@eitch thanks, looks good!

@FDelporte

Copy link
Copy Markdown
Member

looks good!

or not? ;-)

Error:    RegistryTest.testCreateMultipleSameAddress:102 » IOAlreadyExists IO instance [DIN-3] already exists in the Pi4J runtime context; unable to create a new instance using this reserved id.
Error:    RegistryTest.testShutdownAndRecreate:89 » IOAlreadyExists IO instance [DIN-3] already exists in the Pi4J runtime context; unable to create a new instance using this reserved id.

@eitch

eitch commented Sep 5, 2025

Copy link
Copy Markdown
Member Author

There was an issue with tests not cleaned up between each run. Is fixed now.

@eitch

eitch commented Sep 9, 2025

Copy link
Copy Markdown
Member Author

@taartspi @FDelporte can we merge?

@FDelporte

Copy link
Copy Markdown
Member

@taartspi @FDelporte can we merge?

LGTM

@taartspi taartspi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@eitch
eitch merged commit 791d7cd into develop Sep 9, 2025
1 check passed
@eitch
eitch deleted the feature/io-already-exists branch September 11, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants