mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
Simplify TAP config
This commit is contained in:
committed by
Lorenz Meier
parent
c5e11cd16f
commit
0e9c352927
+11
-148
@@ -1,6 +1,6 @@
|
|||||||
#!nsh
|
#!nsh
|
||||||
#
|
#
|
||||||
# PX4FMU startup script.
|
# TAP startup script.
|
||||||
#
|
#
|
||||||
# NOTE: COMMENT LINES ARE REMOVED BEFORE STORED IN ROMFS.
|
# NOTE: COMMENT LINES ARE REMOVED BEFORE STORED IN ROMFS.
|
||||||
#
|
#
|
||||||
@@ -10,29 +10,23 @@
|
|||||||
#
|
#
|
||||||
sercon
|
sercon
|
||||||
|
|
||||||
#
|
|
||||||
# Default to auto-start mode.
|
|
||||||
#
|
|
||||||
set MODE autostart
|
|
||||||
|
|
||||||
set TUNE_ERR ML<<CP4CP4CP4CP4CP4
|
set TUNE_ERR ML<<CP4CP4CP4CP4CP4
|
||||||
set LOG_FILE /fs/microsd/bootlog.txt
|
set LOG_FILE /fs/microsd/bootlog.txt
|
||||||
|
|
||||||
|
tone_alarm start
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try to mount the microSD card.
|
# Try to mount the microSD card.
|
||||||
#
|
#
|
||||||
# REBOOTWORK this needs to start after the flight control loop
|
|
||||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
||||||
then
|
then
|
||||||
# Start playing the startup tune
|
echo "microSD present"
|
||||||
tone_alarm start
|
|
||||||
else
|
else
|
||||||
tone_alarm MBAGP
|
|
||||||
if mkfatfs /dev/mmcsd0
|
if mkfatfs /dev/mmcsd0
|
||||||
then
|
then
|
||||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
||||||
then
|
then
|
||||||
echo "INFO [init] MicroSD card formatted"
|
echo "microSD card formatted"
|
||||||
else
|
else
|
||||||
echo "ERROR [init] Format failed"
|
echo "ERROR [init] Format failed"
|
||||||
tone_alarm MNBG
|
tone_alarm MNBG
|
||||||
@@ -43,22 +37,6 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# Look for an init script on the microSD card.
|
|
||||||
# Disable autostart if the script found.
|
|
||||||
#
|
|
||||||
set FRC /fs/microsd/etc/rc.txt
|
|
||||||
if [ -f $FRC ]
|
|
||||||
then
|
|
||||||
echo "INFO [init] Executing script: $FRC"
|
|
||||||
sh $FRC
|
|
||||||
set MODE custom
|
|
||||||
fi
|
|
||||||
unset FRC
|
|
||||||
|
|
||||||
if [ $MODE == autostart ]
|
|
||||||
then
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start the ORB (first app to start)
|
# Start the ORB (first app to start)
|
||||||
#
|
#
|
||||||
@@ -119,17 +97,16 @@ then
|
|||||||
set FAILSAFE none
|
set FAILSAFE none
|
||||||
set USE_IO no
|
set USE_IO no
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set parameters and env variables for selected AUTOSTART
|
# Set parameters and env variables for selected AUTOSTART
|
||||||
#
|
#
|
||||||
if param compare SYS_AUTOSTART 0
|
if param compare SYS_AUTOSTART 0
|
||||||
then
|
then
|
||||||
echo "INFO [init] No autostart"
|
param set SYS_AUTOSTART 6001
|
||||||
else
|
|
||||||
sh /etc/init.d/rc.autostart
|
|
||||||
fi
|
fi
|
||||||
unset MODE
|
|
||||||
|
# Start canned airframe config
|
||||||
|
sh /etc/init.d/rc.autostart
|
||||||
|
|
||||||
#
|
#
|
||||||
# If autoconfig parameter was set, reset it and save parameters
|
# If autoconfig parameter was set, reset it and save parameters
|
||||||
@@ -174,115 +151,18 @@ then
|
|||||||
#
|
#
|
||||||
load_mon start
|
load_mon start
|
||||||
|
|
||||||
#
|
# Start MAVLink on the gimbal port
|
||||||
# Start primary output
|
|
||||||
#
|
|
||||||
set TTYS1_BUSY no
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if UAVCAN is enabled, default to it for ESCs
|
|
||||||
#
|
|
||||||
if param greater UAVCAN_ENABLE 2
|
|
||||||
then
|
|
||||||
set OUTPUT_MODE uavcan_esc
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If OUTPUT_MODE == none then something is wrong with setup and we shouldn't try to enable output
|
|
||||||
if [ $OUTPUT_MODE != none ]
|
|
||||||
then
|
|
||||||
if [ $OUTPUT_MODE == uavcan_esc ]
|
|
||||||
then
|
|
||||||
if param compare UAVCAN_ENABLE 0
|
|
||||||
then
|
|
||||||
echo "INFO [init] OVERRIDING UAVCAN_ENABLE = 1" >> $LOG_FILE
|
|
||||||
param set UAVCAN_ENABLE 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $OUTPUT_MODE == fmu ]
|
|
||||||
then
|
|
||||||
if fmu mode_$FMU_MODE
|
|
||||||
then
|
|
||||||
else
|
|
||||||
echo "ERR [init] FMU start failed" >> $LOG_FILE
|
|
||||||
tone_alarm $TUNE_ERR
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if fmu mode_pwm4
|
|
||||||
then
|
|
||||||
else
|
|
||||||
echo "ERROR [init] FMU mode_$FMU_MODE start failed" >> $LOG_FILE
|
|
||||||
tone_alarm $TUNE_ERR
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
mavlink start -r 1200 -d /dev/ttyS1
|
mavlink start -r 1200 -d /dev/ttyS1
|
||||||
|
|
||||||
#
|
# Start MAVLink on USB, developers can use the MAVLink shell
|
||||||
# Starting stuff according to UAVCAN_ENABLE value
|
|
||||||
#
|
|
||||||
if param greater UAVCAN_ENABLE 0
|
|
||||||
then
|
|
||||||
if uavcan start
|
|
||||||
then
|
|
||||||
else
|
|
||||||
tone_alarm $TUNE_ERR
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if param greater UAVCAN_ENABLE 1
|
|
||||||
then
|
|
||||||
if uavcan start fw
|
|
||||||
then
|
|
||||||
else
|
|
||||||
tone_alarm $TUNE_ERR
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Optional drivers
|
|
||||||
#
|
|
||||||
|
|
||||||
# Sensors on the PWM interface bank
|
|
||||||
if param compare SENS_EN_LL40LS 1
|
|
||||||
then
|
|
||||||
if pwm_input start
|
|
||||||
then
|
|
||||||
if ll40ls start pwm
|
|
||||||
then
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# sf0x lidar sensor
|
|
||||||
if param compare SENS_EN_SF0X 1
|
|
||||||
then
|
|
||||||
sf0x start
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start USB shell if no microSD present, MAVLink else
|
|
||||||
if [ $LOG_FILE == /dev/null ]
|
|
||||||
then
|
|
||||||
# Try to get an USB console
|
|
||||||
nshterm /dev/ttyACM0 &
|
|
||||||
else
|
|
||||||
mavlink start -r 800000 -d /dev/ttyACM0 -m config -x
|
mavlink start -r 800000 -d /dev/ttyACM0 -m config -x
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Logging
|
# Logging
|
||||||
#
|
#
|
||||||
if param compare SYS_LOGGER 0
|
|
||||||
then
|
|
||||||
if sdlog2 start -r 100 -a -b 9 -t
|
|
||||||
then
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if logger start -b 12 -t
|
if logger start -b 12 -t
|
||||||
then
|
then
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fixed wing setup
|
# Fixed wing setup
|
||||||
@@ -461,26 +341,9 @@ then
|
|||||||
fi
|
fi
|
||||||
unset FEXTRAS
|
unset FEXTRAS
|
||||||
|
|
||||||
# Run no SD alarm
|
|
||||||
if [ $LOG_FILE == /dev/null ]
|
|
||||||
then
|
|
||||||
# Play SOS
|
|
||||||
tone_alarm error
|
|
||||||
fi
|
|
||||||
|
|
||||||
# End of autostart
|
|
||||||
fi
|
|
||||||
|
|
||||||
# There is no further script processing, so we can free some RAM
|
# There is no further script processing, so we can free some RAM
|
||||||
# XXX potentially unset all script variables.
|
# XXX potentially unset all script variables.
|
||||||
unset TUNE_ERR
|
unset TUNE_ERR
|
||||||
|
|
||||||
# Boot is complete, inform MAVLink app(s) that the system is now fully up and running
|
# Boot is complete, inform MAVLink app(s) that the system is now fully up and running
|
||||||
mavlink boot_complete
|
mavlink boot_complete
|
||||||
|
|
||||||
if [ $EXIT_ON_END == yes ]
|
|
||||||
then
|
|
||||||
echo "INFO [init] NSH exit"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
unset EXIT_ON_END
|
|
||||||
|
|||||||
Reference in New Issue
Block a user