Repository navigation
fix: allow CircuitPython UART construction without parity - #317
YashAnand69 wants to merge 2 commits into
Conversation
|
Sorry @YashAnand69, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 17 hours and 28 minutes by commenting |
Reviewer's GuideFixes CircuitPython-compatible UART construction with the default parity=None by conditionally applying the parity mode offset, while adding mocked command-level regressions covering no-parity, explicit parity, stop bits, nine-bit validation, cached configuration, and older firmware. Flow diagram for UART parity mode encodingflowchart TD
A[UART construction] --> B[Set baud rate and base mode]
B --> C{parity is None}
C -->|Yes| D[Keep base mode unchanged]
C -->|No| E[Add parity.value offset]
D --> F[_set_uart_mode]
E --> F
F --> G[UART configured]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No actionable merge risk remains from the reviewed UART changes; merge after normal checks. Pre-merge checks |
|
The CircuitPython-compatible
UARTdefaults toparity=None, but its constructor readsparity.valueunconditionally. Default construction and the supported nine-bit/no-parity configuration therefore fail withAttributeErrorafter setting the baud rate.Apply the parity offset only when parity is supplied. This preserves the existing eight- and nine-bit no-parity modes, explicit even/odd parity, stop-bit encoding and older-firmware fallback. The regression tests check the actual command sequence and restore the cached UART configuration between cases.
Validation: five no-parity regressions fail on unchanged main; all 11 focused cases and 34 available tests pass with the fix. Configured source Black, Flake8, Bandit and pydocstyle, wheel/sdist builds and Sphinx documentation pass (seven existing documentation warnings). Scoped
busiocoverage increases with the same test selection. No physical PSLab or complete hardware integration run is claimed.Prepared with Codex assistance; the change and command-level regressions were reviewed against the current firmware mode encoding.
Summary by Sourcery
Fix UART configuration to handle absent parity while retaining existing mode validation and encoding behavior.
Bug Fixes:
Tests:
Summary by CodeRabbit