Conversation
throttle_channel was a pub struct field set to 2 and never modified. Replace with pub const THROTTLE_CHANNEL: usize = 2. Document the C/Rust convention difference (C uses index 1, Rust uses index 2 — both refer to AETR channel 3 / Throttle). Add test that builds a CRSF frame with a known value in channel 2, parses it, and verifies the throttle mapping produces the correct ESC throttle value (1034 for CRSF value 1000).
There was a problem hiding this comment.
Sorry @kaidokert, you have reached your weekly rate limit of 1500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThrottle channel selection moved from a runtime-configurable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 15 minutes and 32 seconds. Comment |
❌ 2 Tests Failed:
View the full list of 2 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Code Review
This pull request refactors the CRSF parser by replacing the configurable throttle_channel field with a global constant THROTTLE_CHANNEL and adds a unit test for channel extraction. Feedback includes a request to clarify documentation regarding channel indexing conventions to ensure parity with the reference C implementation and a suggestion to remove redundant code in the newly added test.
The comment incorrectly claimed C index 1 mapped to the same channel as Rust index 2. In fact, the C variable is declared but never used (CRSF is behind an uncompiled flag). Updated comment to state this. Remove dead payload construction code left over from test iteration.
Summary
throttle_channelfield →pub const THROTTLE_CHANNEL: usize = 2Test plan
Summary by CodeRabbit
Tests
Refactor