-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactor(library): Flight Modes API and Custom Flight Modes integration, plus code and comments clean-up #84
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.
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
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)
flightModeId
is the same Flight Mode constants you all have been using, thus far.flightModeName
allows you to give your flight mode a name to identify it.This is particularly useful for Custom Flight Modes.
channel
is your chosen channel number from1
to16
.min
is the minimum channel value (in microseconds) that will trigger this mode.max
is 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)
flightMode
is the Flight Mode ID to pass in.disarmed
is whether-or-not you have flicked your Disarmed channel (UsuallyAux1
for ExpressLRS) or not.true
means it is disarmed.false
means it is armed.An example usage situation looks like this:
In order to use the API above, you
MUST
have the following flags set inCFA_Config.hpp
:CRSF_FLIGHTMODES_ENABLED
set to1
1
if you want access to the Custom Flight Modes integration.This is also assuming that you have
CRSF_RC_ENABLED
set to1
(which is the default, by the way. Because the entire library relies on this for everything), and you haveCRSF_TELEMETRY_ENABLED
set to1
if 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.