forked from mirror/joycontrol
nested loops in macros, testbuttons macro, updated aliases
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
jc() {
|
||||
screen -S joycontrol -X stuff "$1^M"
|
||||
}
|
||||
|
||||
jcupdate() {
|
||||
cd ~/joycontrol
|
||||
git pull --ff-only
|
||||
cd
|
||||
cp -f ~/joycontrol/.jc_aliases ~
|
||||
}
|
||||
|
||||
jcstart() {
|
||||
jcupdate
|
||||
screen -dmS ~/joycontrol sudo python3 ~/run_controller_cli.py PRO_CONTROLLER -r 98:E2:55:92:E8:81
|
||||
}
|
||||
|
||||
jcstop() {
|
||||
screen -S joycontrol -X quit
|
||||
}
|
||||
|
||||
jcrestart() {
|
||||
jcstop
|
||||
jcstart
|
||||
}
|
||||
|
||||
jcmacro() {
|
||||
buttonDelay='0.01'
|
||||
if [[ ! -z $2 ]]; then
|
||||
buttonDelay=$2
|
||||
fi
|
||||
|
||||
macro=$(~/joycontrol/expand_nested_loops.sh "~/joycontrol/macro/$1")
|
||||
echo "$macro"
|
||||
|
||||
while read -r line; do
|
||||
if [[ ${line:0:1} != "#" ]]; then
|
||||
jc "$line"
|
||||
jc "sleep $buttonDelay"
|
||||
fi
|
||||
done <<< $macro
|
||||
}
|
||||
|
||||
jclist() {
|
||||
ls ~/joycontrol/macro
|
||||
}
|
||||
|
||||
if screen -ls | grep joycontrol; then
|
||||
echo "joycontrol already running, restart id needed"
|
||||
else
|
||||
jcstart
|
||||
fi
|
||||
Reference in New Issue
Block a user