Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failsafe handling #69

Closed
Tracked by #61
ZZ-Cat opened this issue Jan 18, 2024 Discussed in #51 · 0 comments · Fixed by #79
Closed
Tracked by #61

Add failsafe handling #69

ZZ-Cat opened this issue Jan 18, 2024 Discussed in #51 · 0 comments · Fixed by #79
Assignees

Comments

@ZZ-Cat
Copy link
Owner

ZZ-Cat commented Jan 18, 2024

Discussed in #51

Originally posted by hw999 December 4, 2023
I would like to translate CRSF-channel information into a SBUS-data stream. The SBUS protocol has flags for lost frames and failsafe. I wonder : are there any such flags in the CRSF-protocol and if yes - are they implemented in the library? At first glance I did not discover anything that would show how FS and LF is handled.
Could you please spend a few sentences on how CRSF handles LF and FS ?

How this could be implemented

LF in this instance translates to "lost frame", which happens when a received RC frame fails the CRC check. In the context of SBUS, this is done in hardware, rather than in software. In the context of CRSF, this would need to be done in software.
A simple boolean flag could be retrieved from the serialReciever::CRSF::receiveFrames() function when the CRC on the received frame fails, and I could pass that flag up through to the Sketch Layer.

FS is the failsafe flag, which is a representation of the received frame that has this flag set.
This is where shit could get complicated, because there really is no way to determine a "proper" failsafe.
What most implementations do (or at least the ones I have seen, such as Betaflight, INAV, and RotorFlight) is they'll have a combination of a timeout, the number of consecutive CRC sum fails, and they'll likely be watching the link statistics for things such as RSSI and Link Quality.

There was another project (not listed here on my GitHub) that I worked on, and I wrote and tested my own logic for failsafe implementation.
This provides me with a solid frame of reference for what I could implement here in CRSF for Arduino. In that project, I wrote logic that watched the Link Quality and RSSI fields from the Link Statistics packet in the CRSF data stream from the receiver.

@ZZ-Cat ZZ-Cat self-assigned this Jan 18, 2024
@ZZ-Cat ZZ-Cat added ✨️ Enhancement ✨️ New feature or request Pending 📌 This is waiting for me to check it out labels Jan 18, 2024
@ZZ-Cat ZZ-Cat moved this to Todo in Development Schedule Jan 18, 2024
@ZZ-Cat ZZ-Cat added this to the Version 1.0.0 milestone Jan 18, 2024
@ZZ-Cat ZZ-Cat moved this from Todo to In Progress in Development Schedule Feb 6, 2024
@ZZ-Cat ZZ-Cat added ...in progress 🚧 Development on this is in progress and removed Pending 📌 This is waiting for me to check it out labels Feb 6, 2024
@ZZ-Cat ZZ-Cat removed ✨️ Enhancement ✨️ New feature or request ...in progress 🚧 Development on this is in progress labels Feb 6, 2024
@ZZ-Cat ZZ-Cat closed this as completed in #79 Feb 6, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Development Schedule Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant