composer/projects/gk7205v300_ultimate_oko/general/overlay/usr/bin/saf

59 lines
788 B
Bash
Executable File

#!/bin/sh
SLEEP=0.150
get_focus() {
RES=$(sample_af 0 c & sleep $SLEEP && killall sample_af)
RST=`echo ${RES} | awk '{print $1}'`
echo $RST
}
step_r() {
cur_fs=$(gf)
camhi-motor -d r -s 2
st=`expr $cur_fs + 1`
while [[ $st -gt $cur_fs ]]; do
cur_fs=$(gf)
camhi-motor -d r -s 2
# sleep $SLEEP;
st=$(gf)
done
camhi-motor -d l -s 2
}
step_l() {
cur_fs=$(gf)
camhi-motor -d l -s 2
st=`expr $cur_fs + 1`
while [[ $st -gt $cur_fs ]]; do
cur_fs=$(gf)
camhi-motor -d l -s 2
# sleep $SLEEP;
st=$(gf)
done
camhi-motor -d r -s 2
}
CUR_F=$(gf)
camhi-motor -d l -s 10
STP_R=$(gf)
camhi-motor -d r -s 10
sleep $SLEEP
camhi-motor -d r -s 10
STP_L=$(gf)
camhi-motor -d l -s 10
if [[ $STP_R -gt $CUR_F ]]
then
step_l
else
if [[ $STP_L -gt $CUR_F ]]
then
step_r
fi
fi