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

crsf_rc: add bind command #23294

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

crsf_rc: add bind command #23294

wants to merge 3 commits into from

Conversation

benjinne
Copy link
Contributor

@benjinne benjinne commented Jun 18, 2024

Solved Problem

Ability to bind using the crsf protocol

Fixes #23281

Solution

  • based on spectrum bind method in rc_input and bind packet from betaflight source code
  • adds capability to the crsf_rc module using cli or vehicle_command

Changelog Entry

For release notes:

crsf_rc: add bind command

Alternatives

Add to rc_input module if needed

Test coverage

  • todo test on hardware

I assume vehicle command to bind comes from QGC and we may need to update QGC's UI

if (!strcmp(verb, "bind")) {
uORB::Publication<vehicle_command_s> vehicle_command_pub{ORB_ID(vehicle_command)};
vehicle_command_s vcmd{};
vcmd.command = vehicle_command_s::VEHICLE_CMD_START_RX_PAIR;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this might get weird if other modules (px4io, other rc_input, etc) are running.

Copy link
Contributor Author

@benjinne benjinne Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in general there's only one rc module running per vehicle. If we expect multiple, then maybe we can handle this with the command parameters

0xE8, // Packet CRC8
};

return _uart->write((void *) bindFrame, 9);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any acknowledgement or mechanism for checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any in the betaflight code or ardupilot code. To verify it was successful I think the assumption is you verify the receiver lights blink rapidly signifying it's in bind mode

@benjinne benjinne marked this pull request as ready for review June 25, 2024 17:36
@benjinne
Copy link
Contributor Author

@dagar I've tested and verified that this works.
I verified both crsf_rc bind and using the spectrum bind button in QGC works although any spectrum option will work and it's a bit confusing. We'll need to update QGC to have a generic bind for crossfire and ELRS receivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add feature for CRSF RX binding via cli or vehicle_command
2 participants