CBRK_BUZZER: allow to disable startup sound

The 'if [ $LOG_FILE = /dev/null ]' block can be removed, because
STARTUP_TUNE is already set in that case.
This commit is contained in:
Beat Küng
2019-07-16 08:09:22 +02:00
parent d8da9db04c
commit 92c2d7ae36
2 changed files with 16 additions and 18 deletions
+14 -17
View File
@@ -54,6 +54,7 @@ set PWM_OUT none
set PWM_RATE p:PWM_RATE set PWM_RATE p:PWM_RATE
set RC_INPUT_ARGS "" set RC_INPUT_ARGS ""
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
set STARTUP_TUNE 1
set USE_IO no set USE_IO no
set VEHICLE_TYPE none set VEHICLE_TYPE none
@@ -94,25 +95,22 @@ then
if hardfault_log check if hardfault_log check
then then
# Error tune. # Error tune.
tune_control play -t 2 set STARTUP_TUNE 2
if hardfault_log commit if hardfault_log commit
then then
hardfault_log reset hardfault_log reset
fi fi
else
# Play the startup tune.
tune_control play -t 1
fi fi
else else
# tune SD_INIT # tune SD_INIT
tune_control play -t 16 set STARTUP_TUNE 16
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] card formatted" echo "INFO [init] card formatted"
else else
tune_control play -t 17 set STARTUP_TUNE 17
echo "ERROR [init] format failed" echo "ERROR [init] format failed"
set LOG_FILE /dev/null set LOG_FILE /dev/null
fi fi
@@ -121,17 +119,6 @@ else
fi fi
fi fi
# AEROCORE2 shouldn't have an sd card and CF2 may optionally have an sd card.
if ! ver hwcmp BITCRAZE_CRAZYFLIE GUMSTIX_AEROCORE2
then
# Run no SD alarm.
if [ $LOG_FILE = /dev/null ]
then
# tune Make FS MBAGP
tune_control play -t 2
fi
fi
# #
# Look for an init script on the microSD card. # Look for an init script on the microSD card.
# Disable autostart if the script found. # Disable autostart if the script found.
@@ -175,6 +162,15 @@ else
fi fi
fi 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 # Optional board defaults: rc.board_defaults
# #
@@ -550,6 +546,7 @@ unset PWM_OUT
unset PWM_RATE unset PWM_RATE
unset RC_INPUT_ARGS unset RC_INPUT_ARGS
unset SDCARD_MIXERS_PATH unset SDCARD_MIXERS_PATH
unset STARTUP_TUNE
unset USE_IO unset USE_IO
unset VEHICLE_TYPE unset VEHICLE_TYPE
@@ -154,7 +154,8 @@ PARAM_DEFINE_INT32(CBRK_GPSFAIL, 0);
* *
* Setting this parameter to 782097 will disable the buzzer audio notification. * Setting this parameter to 782097 will disable the buzzer audio notification.
* *
* WARNING: ENABLING THIS CIRCUIT BREAKER IS AT OWN RISK * Setting this parameter to 782090 will disable the startup tune, while keeping
* all others enabled.
* *
* @reboot_required true * @reboot_required true
* @min 0 * @min 0