Skip to content

Commit 9514f24

Browse files
authored
raise error for invalid input (#366)
closes #272
1 parent 51123b4 commit 9514f24

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pycyphal/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.24.2"
1+
__version__ = "1.24.3"

pycyphal/transport/can/media/pythoncan/_pythoncan.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ def _construct_pcan(parameters: _InterfaceParameters) -> can.ThreadSafeBus:
489489
),
490490
)
491491
if isinstance(parameters, _FDInterfaceParameters):
492+
if parameters.bitrate[0] == 0 or parameters.bitrate[1] == 0:
493+
raise InvalidMediaConfigurationError("Bitrate must be non-zero")
492494
# These magic numbers come from the settings of PCAN adapter.
493495
# They don't allow any direct baudrate settings, you have to set all lengths and value of the main frequency.
494496
# Bit lengths below are very universal and can be applied for almost every popular baudrate.

0 commit comments

Comments
 (0)