CRSF: Allow future use of unused bits in the "Arming status byte"#7022
CRSF: Allow future use of unused bits in the "Arming status byte"#7022mha1 wants to merge 5 commits into
Conversation
gagarinlg
left a comment
There was a problem hiding this comment.
what is this part of the code for?
| // Example: flag crsf errors to ELRS in bit 2 for resending linkstats | ||
| // | ||
| //extern bool crsfErrorFlag; | ||
| //if(crsfErrorFlag) { | ||
| // *buf |= 0x04; // flag crsf error | ||
| // crsfErrorFlag = false; | ||
| //} | ||
|
|
||
| buf++; |
There was a problem hiding this comment.
This is indeed example code on how the spare bits can be used, e.g. for debugging. I'll remove the dead code.
There was a problem hiding this comment.
Pull request overview
This PR updates CRSF channel frame generation so the status byte is always appended, enabling arming-mode signaling while leaving higher bits available for future status flags.
Changes:
- Always sends a 25-byte CRSF channel frame payload including the extra status byte.
- Encodes Switch-mode armed state in bit 0 and CH5 arming mode in bit 1.
- Updates CRC calculation to include the always-present status byte.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uint8_t * buf = frame; | ||
| *buf++ = MODULE_ADDRESS; | ||
| *buf++ = 24 + lenAdjust; // 1(ID) + 22(channel data) + (+1 extra byte if Switch mode) + 1(CRC) | ||
| *buf++ = 25; // 1(ID) + 22(channel data) + 1(extra status byte) + 1(CRC) |
| // Example: flag crsf errors to ELRS in bit 2 for resending linkstats | ||
| // | ||
| //extern bool crsfErrorFlag; | ||
| //if(crsfErrorFlag) { | ||
| // *buf |= 0x04; // flag crsf error | ||
| // crsfErrorFlag = false; | ||
| //} | ||
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesCrossfire Frame Status Byte Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This PR allows future use of the currently unused status bits in the byte we use to communicate the commanded arming status to ExpressLRS modules if we ever have a need for them. The changes are fully backward compatible with the existing V2.11 and V2.12 implementation for communicating the commanded arming status to ExpressLRS modules. It is also compatible with modules using ExpressLRS V3 firmware.
Summary of changes:
This complements the changes made to V4 in ExpressLRS/ExpressLRS#3470 and is fully backwards compatible to the existing implementation
Summary by CodeRabbit