Browse Source

🔨 Improve pins_set script

Scott Lahteine 2 years ago
parent
commit
58adb849d3
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      buildroot/bin/pins_set

+ 8
- 4
buildroot/bin/pins_set View File

3
 IFS='/' read -r -a PINPATH <<< "$1"
3
 IFS='/' read -r -a PINPATH <<< "$1"
4
 DIR=${PINPATH[0]}
4
 DIR=${PINPATH[0]}
5
 NAM=${PINPATH[1]}
5
 NAM=${PINPATH[1]}
6
-PIN=$2
7
-VAL=$3
8
 
6
 
9
 SED=$(which gsed sed | head -n1)
7
 SED=$(which gsed sed | head -n1)
10
-eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
11
-(echo "ERROR: pins_set Can't find ${PIN}" >&2 && exit 9)
8
+
9
+shift
10
+while [[ $# > 1 ]]; do
11
+  PIN=$1 ; VAL=$2
12
+  eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
13
+  (echo "ERROR: pins_set Can't find ${PIN}" >&2 && exit 9)
14
+  shift 2
15
+done

Loading…
Cancel
Save