-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(serial receiver interface): ✨ Introduce three new callbacks #134
feat(serial receiver interface): ✨ Introduce three new callbacks #134
Conversation
ddanilchenko
commented
Aug 29, 2024
•
edited
Loading
edited
- on connection down. performs if there is no data received within last CRSF_FAILSAFE_STAGE1_MS (300 ms)
- on connection up. performs when connection was previously in down state and new data received successfully
- raw data received. performs when new data received. can be used in case you need to deal with the raw data
- on connection down - on connection up - raw data received Signed-off-by: Dmytro <ddanilchenko@dataxdev.com>
c79feb3
to
cc39f67
Compare
Before I run my CodeQL and Quality Control workflows on this, can you change the base branch from Also, in your Pull Request description, can you clarify what each callback does and their purpose? |
done. modified the initial comment for the PR. please have as look. a few words about onrawdatareceived. the main purpose of it is to add possibility of handling raw data received by the instance of the SerialReceiver class. in my case i used it to implement seamless integration with fc, e.g. read data from rx, handle crsf packages and bypass raw data to fc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defects detected
My Defect Detector has pinged you in the copy constructor for SerialReceiver.cpp
Summary of defects
src/SerialReceiver/SerialReceiver.cpp:152: [medium:warning] Member variable 'SerialReceiver::_rawDataCallback' is not assigned a value in 'SerialReceiver::operator='. [operatorEqVarError]
src/SerialReceiver/SerialReceiver.cpp:152: [medium:warning] Member variable 'SerialReceiver::_linkUpCallback' is not assigned a value in 'SerialReceiver::operator='. [operatorEqVarError]
src/SerialReceiver/SerialReceiver.cpp:152: [medium:warning] Member variable 'SerialReceiver::_linkDownCallback' is not assigned a value in 'SerialReceiver::operator='. [operatorEqVarError]
Full error message
Possible solution
Consider assigning values to your three callbacks in SerialReceiver::operator=
copy constructor.
Example:
namespace serialReceiverLayer
{
SerialReceiver &SerialReceiver::operator=(const SerialReceiver &serialReceiver)
{
/* ... */
_rawDataCallback = serialReceiver._rawDataCallback;
_linkUpCallback = serialReceiver._linkUpCallback;
_linkDownCallback = serialReceiver._linkDownCallback;
/* ... */
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution here, it's greatly appreciated.
Everything has passed with flying colours. =^/.^=
So, Imma go ahead and update the PR name to bring it in-line with my Conventional Commits and then merge your Pull Request.
Three new callback functions are added to the Serial Receiver Interface: - `onLinkDownCallback` Runs when no CRSF data is received within `CRSF_FAILSAFE_STAGE1_MS` (default is 300 milliseconds), and this may be used to facilitate fail-safe conditions. - `onLinkUpCallback` Runs when a reconnection is established, and this may be used to facilitate fail-safe recovery. - `onRawDataCallback` Runs whenever individual bytes from the raw CRSF data stream is received, and this may be used to facilitate UART pass-through. Signed-off-by: Dmytro <ddanilchenko@dataxdev.com> Co-authored-by: Cassandra "ZZ Cat" Robinson <nicad.heli.flier@gmail.com>