Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autostart: Allow overriding airframe defaults #8006

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 43 additions & 37 deletions ROMFS/px4fmu_common/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ set +e
# UART7 /dev/ttyS5 ?
# UART8 /dev/ttyS6 CONSOLE

#
# Configuration defaults
#
# Increment this variable if the system default configuration
# changes significantly. This will not wipe the param storage
# but force setting the airframe parameters again.
#
set DEFAULTS_VER 1

#
# Mount the procfs.
#
Expand Down Expand Up @@ -60,7 +69,7 @@ set LOG_FILE /fs/microsd/bootlog.txt
# REBOOTWORK this needs to start after the flight control loop
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "[i] microSD mounted: /fs/microsd"
echo "INFO [init] microSD mounted: /fs/microsd"
if hardfault_log check
then
tone_alarm error
Expand Down Expand Up @@ -124,48 +133,48 @@ then
if param load
then
else
if param reset
then
fi
fi

#
# Start system state indicator
#
if rgbled start
then
else
if blinkm start
then
blinkm systemstate
fi
# reset all params if load failed
param reset
fi

# FMUv5 may have both PWM I2C RGB LED support
rgbled_pwm start

#
# Set AUTOCNF flag to use it in AUTOSTART scripts
#
if param compare SYS_AUTOCONFIG 1
then
# Wipe out params except RC* and total flight time
echo "INFO [init] Resetting params to default"
param reset_nostart RC* LND_FLIGHT_T_*
set AUTOCNF yes
else
set AUTOCNF no
fi

#
# Release 1.4.0 transitional support:
# set to old default if unconfigured.
# this preserves the previous behaviour
#
if param compare BAT_N_CELLS 0
#
# Allow overriding airframe defaults as we change them
#
if param compare SYS_PARAM_VER ${DEFAULTS_VER}
then
else
echo "INFO [init] Reapplying airframe default params"
set AUTOCNF yes
fi

#
# Start system state indicator
#
if rgbled start
then
else
if blinkm start
then
param set BAT_N_CELLS 3
blinkm systemstate
fi
fi

# FMUv5 may have both PWM I2C RGB LED support
rgbled_pwm start

#
# Set default values
#
Expand All @@ -185,7 +194,6 @@ then
set PWM_AUX_MIN p:PWM_AUX_MIN
set PWM_AUX_MAX p:PWM_AUX_MAX
set FAILSAFE_AUX none
set MK_MODE none
set FMU_MODE pwm
set AUX_MODE pwm
set FMU_ARGS ""
Expand Down Expand Up @@ -252,9 +260,8 @@ then
#
# Set parameters and env variables for selected AUTOSTART
#
if param compare SYS_AUTOSTART 0
if param greater SYS_AUTOSTART 0
then
else
sh /etc/init.d/rc.autostart
fi
unset MODE
Expand Down Expand Up @@ -310,7 +317,7 @@ then

if px4io checkcrc ${IO_FILE}
then
echo "[init] PX4IO CRC OK" >> $LOG_FILE
echo "[init] PX4IO CRC OK"

set IO_PRESENT yes
else
Expand Down Expand Up @@ -391,9 +398,7 @@ then
fi
# waypoint storage
# REBOOTWORK this needs to start in parallel
if dataman start $DATAMAN_OPT
then
fi
dataman start $DATAMAN_OPT
unset DATAMAN_OPT

#
Expand Down Expand Up @@ -499,7 +504,6 @@ then
fi
unset MKBLCTRL_ARG
fi
unset MK_MODE

if [ $OUTPUT_MODE == hil ]
then
Expand Down Expand Up @@ -1001,11 +1005,13 @@ then
if param compare MNT_MODE_IN -1
then
else
if vmount start
then
fi
vmount start
fi

param set SYS_PARAM_VER ${DEFAULTS_VER}
unset DEFAULTS_VER
param save
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param save is not needed


# End of autostart
fi

Expand Down