Skip to content

Commit

Permalink
Merge pull request #27 from modalai/pr-crsf-tbs
Browse files Browse the repository at this point in the history
add CRSF support to tbs_crossfire driver
  • Loading branch information
katzfey committed Oct 25, 2022
2 parents 19a38a4 + 977be59 commit 49dd87b
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 123 deletions.
6 changes: 4 additions & 2 deletions boards/modalai/rb5-flight/voxl-px4
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ do
d) DAEMON="-d";;
# Use -m to specify Mateksys M8Q-5883 GPS unit
m) G="MATEK";;
# Use -r to specify TBS Crossfire RC receiver
r) R="CRSF";;
# Use -r to specify TBS Crossfire RC receiver, MAVLINK
r) R="CRSF_MAV";;
# Use -r to specify TBS Crossfire RC receiver, raw
c) R="CRSF_RAW";;
# Use -i to specify IMU rotation of ROTATION_YAW_180
i) I="ROTATE_IMU_YAW_180";;
# Use -o to start OSD module on the apps processor
Expand Down
13 changes: 8 additions & 5 deletions boards/modalai/rb5-flight/voxl-px4.config
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,12 @@ else
# If RC is TBS Crossfire then start its driver.
# Otherwise, it could be either a directly connected Spektrum receiver
# or an external M0065 (aka px4io) module.
if [ "$RC" == "CRSF" ]; then
/bin/echo "Starting TBS crossfire RC"
qshell tbs_crossfire start -p 7 -b 115200
if [ "$RC" == "CRSF_MAV" ]; then
/bin/echo "Starting TBS crossfire RC - MAV Mode"
qshell tbs_crossfire start -m -p 7 -b 115200
elif [ "$RC" == "CRSF_RAW" ]; then
/bin/echo "Starting TBS crossfire RC - CRSF Mode"
qshell tbs_crossfire start -c -p 7 -b 250000
else
qshell px4io detect
PX4IO_STATUS=$?
Expand Down Expand Up @@ -226,7 +229,7 @@ modalai_gps_timer start
# now done via the mavlink server and voxl-vision-px4!!!
param set MAV_BROADCAST 0

if [ "$RC" == "CRSF" ]; then
if [ "$RC" == "CRSF_MAV" ]; then
# Slow everything way down if we are using TBS Crossfire
mavlink start -a -x -u 14556 -o 14557 -r 10000 -n lo -m minimal

Expand Down Expand Up @@ -254,7 +257,7 @@ fi
mavlink boot_complete

# For now we use a mavlink bridge for TBS Crossfire support
if [ "$RC" == "CRSF" ]; then
if [ "$RC" == "CRSF_MAV" ]; then
mavlink_bridge start
fi

Expand Down
3 changes: 3 additions & 0 deletions src/drivers/modalai/tbs_crossfire/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ px4_add_module(
-Wno-address-of-packed-member # TODO: fix in c_library_v2
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
${PX4_SOURCE_DIR}/src/drivers/rc_input
SRCS
tbs_crossfire.cpp
${PX4_SOURCE_DIR}/src/drivers/rc_input/crsf_telemetry.cpp
DEPENDS
rc
px4_work_queue
git_mavlink_v2
)

0 comments on commit 49dd87b

Please sign in to comment.