Merge upstream changes from Marlin 2.1.1
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# mftest Select a test to apply and build
|
||||
# mftest -b [#] Build the auto-detected environment
|
||||
# mftest -u [#] Upload the auto-detected environment
|
||||
# mftest [name] [index] [-y] Set config options and optionally build a test
|
||||
# mftest -tname -n# [-y] Set config options and optionally build a test
|
||||
#
|
||||
|
||||
[[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; }
|
||||
@@ -17,6 +17,7 @@ usage() {
|
||||
Usage: mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
|
||||
mftest [-a|--autobuild]
|
||||
mftest [-r|--rebuild]
|
||||
mftest [-s|--silent]
|
||||
mftest [-u|--autoupload] [-n|--num=<num>]
|
||||
|
||||
OPTIONS
|
||||
@@ -29,8 +30,9 @@ OPTIONS
|
||||
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
||||
-v --verbose Extra output for debugging.
|
||||
-s --silent Silence build output from PlatformIO.
|
||||
-d --default Restore to defaults before applying configs.
|
||||
|
||||
env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
||||
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
||||
"
|
||||
}
|
||||
|
||||
@@ -43,6 +45,7 @@ shopt -s extglob nocasematch
|
||||
|
||||
# Matching patterns
|
||||
ISNUM='^[0-9]+$'
|
||||
ISRST='^(restore)_'
|
||||
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
||||
ISEXEC='^exec_'
|
||||
ISCONT='\\ *$'
|
||||
@@ -52,9 +55,10 @@ TESTENV='-'
|
||||
CHOICE=0
|
||||
DEBUG=0
|
||||
|
||||
while getopts 'abhmruvyn:t:-:' OFLAG; do
|
||||
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
|
||||
case "${OFLAG}" in
|
||||
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
||||
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
||||
h) EXIT_USAGE=1 ;;
|
||||
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
||||
n) case "$OPTARG" in
|
||||
@@ -84,8 +88,10 @@ while getopts 'abhmruvyn:t:-:' OFLAG; do
|
||||
esac
|
||||
;;
|
||||
rebuild) REBUILD=1 ; bugout "Rebuilding previous..." ;;
|
||||
silent) SILENT_FLAG="-s" ;;
|
||||
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
||||
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
|
||||
default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
||||
build) case "$OVAL" in
|
||||
''|y|yes) BUILD_YES='Y' ;;
|
||||
n|no) BUILD_YES='N' ;;
|
||||
@@ -150,12 +156,12 @@ if ((AUTO_BUILD)); then
|
||||
*) SYS='uni' ;;
|
||||
esac
|
||||
echo ; echo -n "Auto " ; ((AUTO_BUILD == 2)) && echo "Upload..." || echo "Build..."
|
||||
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//' )
|
||||
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//;s/\r//' )
|
||||
[[ -z $MB ]] && { echo "Error - Can't read MOTHERBOARD setting." ; exit 1 ; }
|
||||
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h )
|
||||
BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
|
||||
BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
|
||||
[[ -z $BNUM ]] && { echo "Error - Can't find $MB in boards list." ; exit 1 ; }
|
||||
[[ -z $BNUM ]] && { echo "Error - Can't find BOARD_$MB in core/boards.h." ; exit 1 ; }
|
||||
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | $SED -E "s/(env|$SYS)://" ) )
|
||||
[[ -z $ENVS ]] && { errout "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; }
|
||||
ECOUNT=${#ENVS[*]}
|
||||
@@ -280,6 +286,11 @@ if [[ $CHOICE == 0 ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Restore to defaults if requested
|
||||
#
|
||||
((DL_DEFAULTS)) && use_example_configs
|
||||
|
||||
#
|
||||
# Run the specified test lines
|
||||
#
|
||||
@@ -301,6 +312,7 @@ echo "$OUT" | {
|
||||
}
|
||||
((IND == CHOICE)) && {
|
||||
GOTX=1
|
||||
[[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs"
|
||||
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
|
||||
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user