Skip to content

fix: only call _validate() when strict=True#2062

Open
dreamer0129 wants to merge 1 commit into
hardbyte:mainfrom
dreamer0129:fix/bit-timing-validation
Open

fix: only call _validate() when strict=True#2062
dreamer0129 wants to merge 1 commit into
hardbyte:mainfrom
dreamer0129:fix/bit-timing-validation

Conversation

@dreamer0129
Copy link
Copy Markdown

Summary

Fix BitTiming rejecting brp values > 64 even when strict=False.

Root Cause

self._validate() was called unconditionally in __init__, even when strict=False. The validation rejects brp values outside [1,64], which is too restrictive for peripherals like FYSETC UCAN that support brp up to 1024.

Fix

Only call _validate() when strict=True:

This makes validation consistent - both and only run when strict=True.

Testing

With this fix, peripherals like FYSETC UCAN (candleLight firmware) can use brp > 64 without ValueError.

Closes #2061

_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 hardbyte#2061
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.

brp parameter validation for BitTiming can be too restrictive for some peripherals

1 participant