File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
ROMFS/px4fmu_common/init.d Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # External airframe startup script (on SD card)
4
+ #
5
+ set SDCARD_MIXERS_PATH ${SDCARD_EXT_PATH} /mixers
6
+
7
+ if [ -e ${SDCARD_EXT_PATH} /rc.autostart ]
8
+ then
9
+ . ${SDCARD_EXT_PATH} /rc.autostart
10
+ else
11
+ echo " Error: ${SDCARD_EXT_PATH} /rc.autostart does not exist"
12
+ fi
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ set PWM_EXTRA_OUT none
44
44
set PWM_EXTRA_RATE p:PWM_EXTRA_RATE
45
45
set EXTRA_MIXER_MODE none
46
46
set RC_INPUT_ARGS " "
47
+ set SDCARD_AVAILABLE no
48
+ set SDCARD_EXT_PATH /fs/microsd/ext_autostart
47
49
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
48
50
set STARTUP_TUNE 1
49
51
set USE_IO no
@@ -57,7 +59,6 @@ ver all
57
59
#
58
60
# Try to mount the microSD card.
59
61
#
60
- set SDCARD_AVAILABLE no
61
62
# REBOOTWORK this needs to start after the flight control loop.
62
63
if mount -t vfat /dev/mmcsd0 /fs/microsd
63
64
then
104
105
fi
105
106
fi
106
107
fi
107
- unset SDCARD_AVAILABLE
108
108
109
109
#
110
110
# Look for an init script on the microSD card.
@@ -206,10 +206,22 @@ else
206
206
#
207
207
# Set parameters and env variables for selected AUTOSTART.
208
208
#
209
+ set AUTOSTART_PATH etc/init.d/rc.autostart
209
210
if ! param compare SYS_AUTOSTART 0
210
211
then
211
- . ${R} etc/init.d/rc.autostart
212
+ if param greater SYS_AUTOSTART 1000000
213
+ then
214
+ # Use external startup file
215
+ if [ $SDCARD_AVAILABLE = yes ]
216
+ then
217
+ set AUTOSTART_PATH etc/init.d/rc.autostart_ext
218
+ else
219
+ echo " ERROR [init] SD card not mounted - trying to load airframe from ROMFS"
220
+ fi
221
+ fi
222
+ . ${R} $AUTOSTART_PATH
212
223
fi
224
+ unset AUTOSTART_PATH
213
225
214
226
#
215
227
# Override parameters from user configuration file.
@@ -540,6 +552,8 @@ unset PWM_OUT
540
552
unset PWM_EXTRA_OUT
541
553
unset PWM_EXTRA_RATE
542
554
unset RC_INPUT_ARGS
555
+ unset SDCARD_AVAILABLE
556
+ unset SDCARD_EXT_PATH
543
557
unset SDCARD_MIXERS_PATH
544
558
unset STARTUP_TUNE
545
559
unset USE_IO
You can’t perform that action at this time.
0 commit comments