Skip to content

Conversation

@Gregox273
Copy link
Contributor

Fix bug in pcan interface where state values cannot be read from config files.


self.check_api_version()

if not isinstance(state, BusState):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is the wrong place for this. The config value should be converted in can.util._create_bus_config().

@zariiii9003
Copy link
Collaborator

Could you add a test to TestBusConfig in test/test_util.py?

)
state = can_cfg["state"]
assert isinstance(state, can.BusState)
assert state == can.BusState.PASSIVE
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: enums should be compared by identity (state is can.BusState.PASSIVE)

)
state = can_cfg["state"]
assert isinstance(state, can.BusState)
assert state == expected_state
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator

@zariiii9003 zariiii9003 left a comment

Choose a reason for hiding this comment

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

Thank you

@zariiii9003 zariiii9003 merged commit 32f07c3 into hardbyte:main Jul 22, 2025
28 checks passed
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.

2 participants