mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-12 23:47:35 +08:00
drivers/tone_alarm and tune_control small improvements/cleanup
- drivers/tone_alarm: move to ModuleBase and purge CDev (/dev/tone_alarm0) - drivers/tone_alarm: only run on tune_control publication (or scheduled note) rather than continuously - drivers/tone_alarm: use HRT to schedule tone stop (prevents potential disruption) - msg/tune_control: add tune_id numbering - systemcmds/tune_control: add "error" special case tune_id - move all tune_control publication to new uORB::PublicationQueued<> - start tone_alarm immediately after board defaults are loaded to fix potential startup issues - for SITL (or other boards with no TONE output) print common messages (startup, error, etc)
This commit is contained in:
@@ -77,8 +77,7 @@ then
|
||||
|
||||
if ! mkblctrl $MKBLCTRL_ARG
|
||||
then
|
||||
# Error tune.
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -86,8 +85,7 @@ then
|
||||
then
|
||||
if ! pwm_out_sim start -m $OUTPUT_MODE
|
||||
then
|
||||
# Error tune.
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -96,8 +94,7 @@ then
|
||||
if ! $OUTPUT_CMD mode_$FMU_MODE
|
||||
then
|
||||
echo "$OUTPUT_CMD start failed" >> $LOG_FILE
|
||||
# Error tune.
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -176,7 +173,7 @@ then
|
||||
else
|
||||
echo "ERROR [init] Failed loading mixer: ${MIXER_FILE}"
|
||||
echo "ERROR [init] Failed loading mixer: ${MIXER_FILE}" >> $LOG_FILE
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -184,7 +181,7 @@ else
|
||||
then
|
||||
echo "ERROR [init] Mixer undefined"
|
||||
echo "ERROR [init] Mixer undefined" >> $LOG_FILE
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -234,7 +231,7 @@ then
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Could not start: pwm_out mode_pwm" >> $LOG_FILE
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
set PWM_AUX_OUT none
|
||||
set FAILSAFE_AUX none
|
||||
fi
|
||||
|
||||
@@ -18,6 +18,6 @@ then
|
||||
px4io recovery
|
||||
else
|
||||
echo "PX4IO start failed" >> $LOG_FILE
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # PROG_PX4IO_ERR
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -130,14 +130,14 @@ then
|
||||
|
||||
else
|
||||
# tune SD_INIT
|
||||
set STARTUP_TUNE 16
|
||||
set STARTUP_TUNE 14 # tune 14 = SD_INIT
|
||||
if mkfatfs /dev/mmcsd0
|
||||
then
|
||||
if mount -t vfat /dev/mmcsd0 /fs/microsd
|
||||
then
|
||||
echo "INFO [init] card formatted"
|
||||
else
|
||||
set STARTUP_TUNE 17
|
||||
set STARTUP_TUNE 15 # tune 15 = SD_ERROR
|
||||
echo "ERROR [init] format failed"
|
||||
set LOG_FILE /dev/null
|
||||
fi
|
||||
@@ -186,15 +186,6 @@ else
|
||||
set AUTOCNF yes
|
||||
fi
|
||||
|
||||
#
|
||||
# Play the startup tune (if not disabled or there is an error)
|
||||
#
|
||||
param compare CBRK_BUZZER 782090
|
||||
if [ $? != 0 -o $STARTUP_TUNE != 1 ]
|
||||
then
|
||||
tune_control play -t $STARTUP_TUNE
|
||||
fi
|
||||
|
||||
#
|
||||
# Optional board defaults: rc.board_defaults
|
||||
#
|
||||
@@ -206,6 +197,21 @@ else
|
||||
fi
|
||||
unset BOARD_RC_DEFAULTS
|
||||
|
||||
#
|
||||
# Start the tone_alarm driver.
|
||||
# Needs to be started after the parameters are loaded (for CBRK_BUZZER).
|
||||
#
|
||||
tone_alarm start
|
||||
|
||||
#
|
||||
# Play the startup tune (if not disabled or there is an error)
|
||||
#
|
||||
param compare CBRK_BUZZER 782090
|
||||
if [ $? != 0 -o $STARTUP_TUNE != 1 ]
|
||||
then
|
||||
tune_control play -t $STARTUP_TUNE
|
||||
fi
|
||||
|
||||
#
|
||||
# Waypoint storage.
|
||||
# REBOOTWORK this needs to start in parallel.
|
||||
@@ -236,13 +242,6 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Start the tone_alarm driver.
|
||||
# Needs to be started after the parameters are loaded (for CBRK_BUZZER).
|
||||
# Note that this will still play the already published startup tone.
|
||||
#
|
||||
tone_alarm start
|
||||
|
||||
#
|
||||
# Set parameters and env variables for selected AUTOSTART.
|
||||
#
|
||||
@@ -286,7 +285,7 @@ else
|
||||
set IO_PRESENT yes
|
||||
else
|
||||
# tune Program PX4IO
|
||||
tune_control play -t 18
|
||||
tune_control play -t 16 # tune 16 = PROG_PX4IO
|
||||
|
||||
if px4io start
|
||||
then
|
||||
@@ -305,8 +304,7 @@ else
|
||||
if px4io checkcrc ${IOFW}
|
||||
then
|
||||
echo "PX4IO CRC OK after updating" >> $LOG_FILE
|
||||
#tune MLL8CDE Program PX4IO success
|
||||
tune_control play -t 19
|
||||
tune_control play -t 17 # tune 17 = PROG_PX4IO_OK
|
||||
set IO_PRESENT yes
|
||||
fi
|
||||
fi
|
||||
@@ -314,8 +312,7 @@ else
|
||||
if [ $IO_PRESENT = no ]
|
||||
then
|
||||
echo "PX4IO update failed" >> $LOG_FILE
|
||||
# Error tune.
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -332,8 +329,7 @@ else
|
||||
if [ $USE_IO = yes -a $IO_PRESENT = no ]
|
||||
then
|
||||
echo "PX4IO not found" >> $LOG_FILE
|
||||
# Error tune.
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
|
||||
#
|
||||
@@ -447,8 +443,7 @@ else
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Error tune.
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -30,11 +30,10 @@ if [ $? = 0 ]
|
||||
then
|
||||
echo "[i] card mounted at /fs/microsd"
|
||||
# Start playing the startup tune
|
||||
tune_control play -t 1
|
||||
tune_control play -t 1 # tune 1 = STARTUP
|
||||
else
|
||||
echo "[i] no microSD card found"
|
||||
# Play SOS
|
||||
tune_control play -t 2
|
||||
tune_control play error
|
||||
fi
|
||||
|
||||
#
|
||||
@@ -90,22 +89,22 @@ then
|
||||
echo "PX4IO CRC OK"
|
||||
else
|
||||
echo "PX4IO CRC failure"
|
||||
tune_control play -t 18
|
||||
tune_control play -t 16 # tune 16 = PROG_PX4IO
|
||||
if px4io forceupdate 14662 $io_file
|
||||
then
|
||||
if px4io start
|
||||
then
|
||||
echo "PX4IO restart OK"
|
||||
tune_control play -t 19
|
||||
tune_control play-t 17 # tune 17 = PROG_PX4IO_OK
|
||||
else
|
||||
echo "PX4IO restart failed"
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
set unit_test_failure 1
|
||||
set unit_test_failure_list "${unit_test_failure_list} px4io_flash"
|
||||
fi
|
||||
else
|
||||
echo "PX4IO update failed"
|
||||
tune_control play -t 20
|
||||
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
|
||||
set unit_test_failure 1
|
||||
set unit_test_failure_list "${unit_test_failure_list} px4io_flash"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user