refactor(library): Flight Modes API and Custom Flight Modes integration, plus code and comments clean-up#84
Merged
ZZ-Cat merged 31 commits intoMain-Trunkfrom Feb 20, 2024
Merged
Conversation
These were being called twice, resulting in unnecessary bloat.
…nt Mode is enabled
…n `SerialReceiver::begin()` A hardware fault is triggered when there is insufficient memory available anyway.
…e RC Channels Callback if a frame has been received Polling for RC channels when none have been received is unnecessary
…PTIMISATION_HARDWARE` Hardware-accelerated CRC is not yet implemented.
27 tasks
Owner
Author
|
Ugh! =-/.(\= |
…fixes their fault detection issue This whittles the Arduino CI back to merely checking for correct code format.
…elemetryWriteFlightMode()` up to the Sketch Layer This is the first of two parts to re-factoring the Flight Modes telemetry function.
…eceiverLayer::flightModeId_t flightMode, uint8_t channel, uint16_t min, uint16_t max)`
…lightMode(const char *flightMode, bool armed)`
…tMode(flightModeId_t flightMode, uint8_t channel, uint16_t min, uint16_t max)`
…yWriteCustomFlightMode(const char *flightModeStr, bool armed)`
…th existing Flight Modes API
ZZ-Cat
commented
Feb 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This Pull Request is the "final touches" I need to do with the code-base before it's released.
It brings in some much needed housekeeping, and quality-of-life fixes.
Details
Deleted...
Disabled...
Fixes...
serialReceiverLayer::SerialReceiver::SerialReceiver();Re-factors...
API changes
Flight Modes API
Both standard and custom flight modes are registered with this function:
setFlightMode(serialReceiverLayer::flightModeId_t flightModeId, const char *flightModeName, uint8_t channel, uint16_t min, uint16_t max)flightModeIdis the same Flight Mode constants you all have been using, thus far.flightModeNameallows you to give your flight mode a name to identify it.This is particularly useful for Custom Flight Modes.
channelis your chosen channel number from1to16.minis the minimum channel value (in microseconds) that will trigger this mode.maxis the maximum channel value (in microseconds) that will trigger this mode.Both standard Flight Modes and custom Flight Modes are written out using this function:
telemetryWriteFlightMode(serialReceiverLayer::flightModeId_t flightMode, bool disarmed)flightModeis the Flight Mode ID to pass in.disarmedis whether-or-not you have flicked your Disarmed channel (UsuallyAux1for ExpressLRS) or not.truemeans it is disarmed.falsemeans it is armed.An example usage situation looks like this:
In order to use the API above, you
MUSThave the following flags set inCFA_Config.hpp:CRSF_FLIGHTMODES_ENABLEDset to11if you want access to the Custom Flight Modes integration.This is also assuming that you have
CRSF_RC_ENABLEDset to1(which is the default, by the way. Because the entire library relies on this for everything), and you haveCRSF_TELEMETRY_ENABLEDset to1if you want your Flight Modes to be fed back to your controller.Additional
Now that this is complete. All that is left is the documentation.
Then, CRSF for Arduino version 1.0.0 will be released to the public.
Thank you all from the bottom of my heart for being here, and using my library in your projects.
A huge thanks to those daring enough to try out CRSF for Arduino in its various stages of jankiness-to-refinement and everything in between.