Skip to content

Commit b4f82ab

Browse files
dreamer0129小慧zariiii9003
authored
fix: only call _validate() when strict=True (#2062)
* fix: only call _validate() when strict=True _validate() was called unconditionally, rejecting brp values > 64 even when strict=False. This is too restrictive for some peripherals like FYSETC UCAN which support brp up to 1024. Only call _validate() when strict=True, matching the behavior of _restrict_to_minimum_range(). Fixes #2061 * add news fragment --------- Co-authored-by: 小慧 <xiaohui@192.168.5.97> Co-authored-by: zariiii9003 <52598363+zariiii9003@users.noreply.github.com>
1 parent 6b1f053 commit b4f82ab

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

can/bit_timing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def __init__(
7474
"sjw": sjw,
7575
"nof_samples": nof_samples,
7676
}
77-
self._validate()
7877
if strict:
78+
self._validate()
7979
self._restrict_to_minimum_range()
8080

8181
def _validate(self) -> None:

doc/changelog.d/2061.fixed.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``can.BitTiming`` rejecting bit rate prescaler values greater than 64 even when ``strict=False``.

0 commit comments

Comments
 (0)