19 Commits

Author SHA1 Message Date
zjamnik ee00561ae0 new default delay and interface chenges acounted for in testbuttons macro 2026-04-03 15:37:26 +02:00
zjamnik b6309bd1c1 changes from working copy 2026-03-26 09:49:29 +01:00
zjamnik 335f48002e macros update 2026-02-15 22:02:43 +01:00
zjamnik c36ec55ee2 macro update 2025-06-26 22:50:21 +02:00
zjamnik cbcaae4002 macro update 2025-06-26 22:49:55 +02:00
zjamnik 80de0365a3 macro update 2025-06-26 22:48:50 +02:00
zjamnik 5a60f2e811 macro update 2025-06-26 22:46:38 +02:00
zjamnik ec9f2da4e3 releasebox pkm s/v 2025-06-26 22:46:05 +02:00
zjamnik 1d75012a3a button delay fix for reliability 2025-06-26 22:41:45 +02:00
zjamnik 84a5768f38 copy macros to ~ 2025-06-26 22:38:18 +02:00
zjamnik 1f4c1a33c0 test buttons fix 2025-06-26 22:35:16 +02:00
zjamnik 052299e430 script path fix 2025-06-26 22:30:33 +02:00
zjamnik d6627dfe3e fix alias screen session name 2025-06-26 22:27:29 +02:00
zjamnik 269567f4f3 delete old aliases 2025-06-26 22:24:18 +02:00
zjamnik 0df9a11c2d nested loops in macros, testbuttons macro, updated aliases 2025-06-26 22:24:01 +02:00
zjamnik f97156f503 default button delay in macro, tmacto to test buttons 2025-06-26 20:37:33 +02:00
zjamnik 138d742342 bash aliases, autostart and macros 2025-06-25 02:28:14 +02:00
zjamnik 21508b1124 sleep to float convert 2025-06-24 23:13:54 +02:00
zjamnik b878f05b5c sleep added 2025-06-24 23:09:32 +02:00
8 changed files with 191 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
jc() {
screen -S joycontrol -X stuff "$1^M"
}
jcupdate() {
cd ~/joycontrol
git pull --ff-only
cd
cp -f ~/joycontrol/.jc_aliases ~
cp -f ~/joycontrol/macro/* ~
}
jcstart() {
jcupdate
screen -dmS joycontrol sudo python3 ~/joycontrol/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.08'
if [[ ! -z $2 ]]; then
buttonDelay=$2
fi
macro=$(~/joycontrol/expand_nested_loops.sh "$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
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
# Recursively read lines until EOF or a "loopend" is encountered.
# Prints everything it reads, expanding any nested loops.
expand() {
local line repeat body
# Read one line at a time
while IFS= read -r line; do
# If this is the start of a loop, grab the count
if [[ $line =~ ^[[:space:]]*loop[[:space:]]+([0-9]+)[[:space:]]*$ ]]; then
repeat=${BASH_REMATCH[1]}
# Recursively collect inner block into an array
mapfile -t body < <( expand )
# Print that block "repeat" times
for ((i=0; i<repeat; i++)); do
printf '%s\n' "${body[@]}"
done
# If this is the end of the current loop, return to caller
elif [[ $line =~ ^[[:space:]]*loopend[[:space:]]*$ ]]; then
return
# Otherwise, just print the line verbatim
else
printf '%s\n' "$line"
fi
done
}
# Kick it off: read from file if given, otherwise stdin
expand < "${1:-/dev/stdin}"
+40
View File
@@ -0,0 +1,40 @@
# close game
home
x
a
# go to settings
hold down
sleep 1
release down
hold right
sleep 1.5
release right
left
a
sleep 1.2
# go to system settings
loop 16
down
loopend
a
sleep 0.5
# go to date settings
loop 7
down
loopend
a
sleep 0.5
# open time settings
down
down
a
sleep 0.5
# change day
right
up
loop 6
a
loopend
# back to game
home
a
+12
View File
@@ -0,0 +1,12 @@
loop 5
loop 6
#release mon
sleep 0.2
right
loopend
right
down
loopend
down
down
down
+44
View File
@@ -0,0 +1,44 @@
# go to settings
hold down
sleep 1
release down
hold right
sleep 1.5
release right
left
a
sleep 1.2
#go to controller settings
hold down
sleep 2
release down
loop 8
up
loopend
a
sleep 1.2
# go to test inputs
loop 12
down
loopend
a
sleep 1.2
a
sleep 1
# test buttons
up
right
down
left
a
b
x
y
plus
minus
l
r
zl
zr
l_stick
r_stick
+9
View File
@@ -264,6 +264,15 @@ def _register_commands_with_controller_state(controller_state, cli):
cli.add_command(nfc.__name__, nfc)
#sleep
async def sleep(*args):
"""
sleep - waits specified amount of seconds
"""
await asyncio.sleep(float(args[0]))
cli.add_command(sleep.__name__, sleep)
async def _main(args):
# parse the spi flash
+1
View File
@@ -0,0 +1 @@
sudo python3 run_controller_cli.py PRO_CONTROLLER -r 98:E2:55:92:E8:81
+1
View File
@@ -0,0 +1 @@
98:E2:55:92:E8:81