#!/bin/bash

A="90:00:00"
H="85:00:00"

function sendcmd(){
	echo $1 | nc 192.168.70.33 10001 -q10
}

for x in $(seq 1 10); do
sendcmd ":Sz${A}#"
sendcmd ":Sa${H}#"
sendcmd ":MS#"
while true; do
	ANS=$(sendcmd ":Gstat#")
	echo $ANS
	[ $ANS == "0#" ] && break
	sleep 2
done

sleep 5
./preflash
/usr/bin/fli_control -r /tmp/10micron.fitsheader -x 15000 -Y flat flat
done

fli_control -v32 -h32 -x1 -d
