posix-configs/rpi: Fix mavlink over UART (/dev/ttyAMA0)

UART is the primary interface for telemetry radio: https://docs.emlid.com/navio2/ardupilot/hardware-setup/#uart-radio

Check first if /dev/ttyUSB0 exists (https://docs.emlid.com/navio2/ardupilot/hardware-setup/#usb-radio); if not, fall back to configuring over UART (/dev/ttyAMA0).

Use stricter check for character special file (-c) rather than just file (-f).

'console=serial0,115200' needs to be removed from /cmdline.txt as additional configuration step. This should be documented in the Navio2 section of docs.px4.io. Presumably, this is already performed as part of the Raspberry Pi OS prebuilt image Emlid spins.
This commit is contained in:
blazczak
2020-10-03 07:51:27 -07:00
committed by GitHub
parent 91fa2002e3
commit 57da61dc17
3 changed files with 12 additions and 3 deletions

View File

@@ -45,9 +45,12 @@ mc_rate_control start
mavlink start -x -u 14556 -r 1000000 mavlink start -x -u 14556 -r 1000000
if [ -f /dev/ttyUSB0 ] if [ -c /dev/ttyUSB0 ]
then then
mavlink start -x -d /dev/ttyUSB0 mavlink start -x -d /dev/ttyUSB0
elif [ -c /dev/ttyAMA0 ]
then
mavlink start -x -d /dev/ttyAMA0
fi fi
navio_sysfs_rc_in start navio_sysfs_rc_in start

View File

@@ -44,9 +44,12 @@ fw_pos_control_l1 start
mavlink start -x -u 14556 -r 1000000 mavlink start -x -u 14556 -r 1000000
if [ -f /dev/ttyUSB0 ] if [ -c /dev/ttyUSB0 ]
then then
mavlink start -x -d /dev/ttyUSB0 mavlink start -x -d /dev/ttyUSB0
elif [ -c /dev/ttyAMA0 ]
then
mavlink start -x -d /dev/ttyAMA0
fi fi
navio_sysfs_rc_in start navio_sysfs_rc_in start

View File

@@ -44,9 +44,12 @@ mc_att_control start
mavlink start -x -u 14556 -r 1000000 mavlink start -x -u 14556 -r 1000000
if [ -f /dev/ttyUSB0 ] if [ -c /dev/ttyUSB0 ]
then then
mavlink start -x -d /dev/ttyUSB0 mavlink start -x -d /dev/ttyUSB0
elif [ -c /dev/ttyAMA0 ]
then
mavlink start -x -d /dev/ttyAMA0
fi fi
navio_sysfs_rc_in start navio_sysfs_rc_in start