Add better reaction to -q keyword

This commit is contained in:
2020-10-19 15:20:06 +03:00
parent fe0fe62cad
commit 6ef30d6d2a
10 changed files with 139 additions and 24 deletions

22
commandline/cfg/Oscill Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
Ampl=$1
./steppermove -s250
./steppermove -I1 -m4000
./steppermove -I2 -m4000
#if false; then
./steppermove -I2 -qr-3000
./steppermove -I1 -qr-3000
./steppermove -I2 -qw -r500
./steppermove -I1 -qr500
./steppermove -I2 -qw
#fi
while true; do
./steppermove -I2 -qwr${Ampl}
./steppermove -I1 -qr${Ampl}
./steppermove -I2 -qwr-${Ampl}
./steppermove -I1 -qr-${Ampl}
done

View File

@@ -0,0 +1,8 @@
# Transmit SDO to driver
# Format: index, subindex, data
# Set max phase current to 800mA
0x600B, 0, 800
# Save parameters
0x2007, 0, 2

View File

@@ -0,0 +1,8 @@
# Transmit SDO to driver
# Format: index, subindex, data
# Set max phase current to 600mA
0x600B, 0, 1000
# Save parameters
0x2007, 0, 2

View File

@@ -0,0 +1,8 @@
# Transmit SDO to driver
# Format: index, subindex, data
# Set max phase current to 600mA
0x600B, 0, 1500
# Save parameters
0x2007, 0, 2

View File

@@ -0,0 +1,8 @@
# Transmit SDO to driver
# Format: index, subindex, data
# Set max phase current to 2A
0x600B, 0, 2000
# Save parameters
0x2007, 0, 2

37
commandline/cfg/TurretMove Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
function move(){
./steppermove -I4 $*
}
if [ $# -ne 1 ]; then
echo "Usage: $0 Nposition (enumeration from 0)" >&2
exit 1
fi
if [ $1 -lt 0 -o $1 -gt 5 ]; then
echo "Turet position should be from 0 to 5" >&2
exit 2
fi
LAST=-1
[ -f lastpos ] && LAST=$(cat lastpos)
eval "$(move -s250 -m50)"
DIFF=$((CURENCODER - LAST))
ABS=${DIFF#-} # absoulte value
if [ $ABS -gt 3 ]; then # goto zero if last position differs more then for 3 from current
move -cE1 -r-1000
move -wcA
move -0
fi
move -Fa $((683*$1))
move -w
sleep 1 # wait for stopping
eval "$(move)"
echo $CURENCODER > lastpos
echo "Current encoder position: $CURENCODER"