mirror of
https://github.com/eddyem/small_tel.git
synced 2026-01-31 20:35:09 +03:00
add wind check in Weather_chk
This commit is contained in:
parent
c53e6e4932
commit
6ce4855491
@ -23,6 +23,7 @@
|
|||||||
#include <usefull_macros.h>
|
#include <usefull_macros.h>
|
||||||
#include "cmdlnopts.h"
|
#include "cmdlnopts.h"
|
||||||
|
|
||||||
|
#define ERRCTR_MAX 7
|
||||||
#define BUFLEN 2048
|
#define BUFLEN 2048
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,38 +54,47 @@ int main(int argc, char **argv){
|
|||||||
initial_setup();
|
initial_setup();
|
||||||
G = parse_args(argc, argv);
|
G = parse_args(argc, argv);
|
||||||
TTY_descr *dev = new_tty(G->ttyname, G->speed, 64);
|
TTY_descr *dev = new_tty(G->ttyname, G->speed, 64);
|
||||||
if(!dev || !(dev = tty_open(dev, 1))) return 1; // open exclusively
|
if(!dev) return 1;
|
||||||
size_t got, L = 0;
|
size_t got, L = 0;
|
||||||
char buff[BUFLEN], *ptr = buff;
|
char buff[BUFLEN], *ptr = buff;
|
||||||
int errctr = 0;
|
int errctr = 0;
|
||||||
for(errctr = 0; errctr < 5; ++errctr){
|
for(; errctr < ERRCTR_MAX; ++errctr){
|
||||||
|
if(!tty_open(dev, 1)){
|
||||||
|
sleep(1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
while(read_tty(dev)); // clear buffer
|
while(read_tty(dev)); // clear buffer
|
||||||
if(write_tty(dev->comfd, "?U\r\n", 3)){
|
if(write_tty(dev->comfd, "?U\r\n", 3)){
|
||||||
WARNX("write_tty()");
|
WARNX("write_tty()");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double t0 = dtime();
|
double t0 = dtime();
|
||||||
while(dtime() - t0 < 1.){ // timeout - 1s
|
while(dtime() - t0 < 10.){ // timeout - 10s
|
||||||
got = read_tty(dev);
|
got = read_tty(dev);
|
||||||
if(got == 0) continue;
|
if(got == 0) continue;
|
||||||
t0 = dtime();
|
t0 = dtime();
|
||||||
|
if(L + got > BUFLEN - 1) break;
|
||||||
L += got;
|
L += got;
|
||||||
|
buff[L] = 0;
|
||||||
if(BUFLEN > L){
|
if(BUFLEN > L){
|
||||||
strncpy(ptr, dev->buf, dev->buflen);
|
strncpy(ptr, dev->buf, dev->buflen);
|
||||||
ptr += got;
|
ptr += got;
|
||||||
}else break;
|
}else break;
|
||||||
|
if(buff[L-1] == '\n' && L > 8) break; // full line received
|
||||||
}
|
}
|
||||||
buff[L] = 0;
|
|
||||||
if(L == 0){
|
if(L == 0){
|
||||||
WARNX("Got nothing from TTY");
|
WARNX("Got nothing from TTY");
|
||||||
continue;
|
continue;
|
||||||
}else if(strncmp(buff, "<?U>", 4)){
|
}else if(strncmp(buff, "<?U>", 4)){
|
||||||
WARNX("Wrong answer: %s", buff);
|
WARNX("Wrong answer: %s", buff);
|
||||||
|
L = 0;
|
||||||
|
ptr = buff;
|
||||||
continue;
|
continue;
|
||||||
}else break;
|
}else break;
|
||||||
}
|
}
|
||||||
if(errctr == 5){
|
while(read_tty(dev));
|
||||||
close_tty(&dev);
|
close_tty(&dev);
|
||||||
|
if(errctr == ERRCTR_MAX){
|
||||||
ERRX("No connection to meteostation");
|
ERRX("No connection to meteostation");
|
||||||
}
|
}
|
||||||
ptr = &buff[4];
|
ptr = &buff[4];
|
||||||
@ -96,10 +106,18 @@ int main(int argc, char **argv){
|
|||||||
if(eol) *eol = 0;
|
if(eol) *eol = 0;
|
||||||
DBG("Now: %s\n", ptr);
|
DBG("Now: %s\n", ptr);
|
||||||
if(G->showraw) green("%s\n", ptr);
|
if(G->showraw) green("%s\n", ptr);
|
||||||
double rain = 1., clouds = 1.;
|
double rain = 1., clouds = 1., temperature = -300., wind = 100.;//, windpeak = 100.;
|
||||||
if(!getpar(ptr, &rain, "RT")) printf("Rain=%g\n", rain);
|
if(!getpar(ptr, &rain, "RT")) printf("Rain=%g\n", rain);
|
||||||
if(!getpar(ptr, &clouds, "WU")) printf("Clouds=%g\n", clouds);
|
if(!getpar(ptr, &clouds, "WU")) printf("Clouds=%g\n", clouds);
|
||||||
close_tty(&dev);
|
if(!getpar(ptr, &temperature, "TE")) printf("Exttemp=%g\n", temperature);
|
||||||
if(rain > 0.1 || clouds < 1800.) return 1;
|
if(!getpar(ptr, &wind, "WG")){
|
||||||
|
wind /= 3.6;
|
||||||
|
printf("Wind=%.1f\n", wind);
|
||||||
|
}
|
||||||
|
/* if(!getpar(ptr, &windpeak, "WS")){
|
||||||
|
windpeak /= 3.6;
|
||||||
|
printf("Windpeak=%.1f\n", windpeak);
|
||||||
|
}*/
|
||||||
|
if(rain > 0.1 || clouds < 1900. || wind > 20.) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
26
Auxiliary_utils/bash_scripts/getflats
Executable file
26
Auxiliary_utils/bash_scripts/getflats
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/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
|
||||||
52
Auxiliary_utils/bash_scripts/run
Executable file
52
Auxiliary_utils/bash_scripts/run
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
RA="00:12:15"
|
||||||
|
DEC="50:25:21"
|
||||||
|
OBJ="EGGR381"
|
||||||
|
OBS="Emelianov E.V."
|
||||||
|
|
||||||
|
last=$(date -d "Oct 23 05:30" +%s)
|
||||||
|
echo "Time diff: $(($last-$(date +%s)))"
|
||||||
|
if [ $(($last-$(date +%s))) -lt 3600 ]; then
|
||||||
|
echo "There's less an hour for observation!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
export http_proxy=""
|
||||||
|
|
||||||
|
echo "GoTo object: ${RA} ${DEC}"
|
||||||
|
send_coords -r${RA} -d${DEC}
|
||||||
|
echo "Start taking object"
|
||||||
|
|
||||||
|
badweatger=0
|
||||||
|
while true; do
|
||||||
|
now=$(date +%s)
|
||||||
|
chkweather -r -d /dev/ttyS3 > lastweather && badweather=0 || badweather=$((badweather+1))
|
||||||
|
#echo "badweather: $badweather"
|
||||||
|
[ $badweather -gt 5 ] && break
|
||||||
|
#continue
|
||||||
|
if [ "$now" -lt "$last" ]; then
|
||||||
|
ST=$(send_coords | awk '{print $4}')
|
||||||
|
if [ $ST -ne "0" ]; then
|
||||||
|
touch lastpointing
|
||||||
|
send_coords -r${RA} -d${DEC}
|
||||||
|
else
|
||||||
|
preflash
|
||||||
|
/usr/bin/fli_control -r /tmp/10micron.fitsheader -x 60000 -N "${OBS}" -O "${OBJ}" "$OBJ"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
#exit 0
|
||||||
|
|
||||||
|
echo "closed" > closed
|
||||||
|
curl localhost:4444/close
|
||||||
|
curl localhost:55555/close
|
||||||
|
|
||||||
|
for x in $(seq 1 10); do
|
||||||
|
preflash
|
||||||
|
/usr/bin/fli_control -x60000 -d dark
|
||||||
|
preflash
|
||||||
|
/usr/bin/fli_control -x1 -d bias
|
||||||
|
done
|
||||||
|
|
||||||
|
STOPobs
|
||||||
0
Daemons/astrosib/HWoff
Executable file → Normal file
0
Daemons/astrosib/HWoff
Executable file → Normal file
0
Daemons/astrosib/HWon
Executable file → Normal file
0
Daemons/astrosib/HWon
Executable file → Normal file
0
Daemons/astrosib/STARTobs
Executable file → Normal file
0
Daemons/astrosib/STARTobs
Executable file → Normal file
0
Daemons/astrosib/STOPobs
Executable file → Normal file
0
Daemons/astrosib/STOPobs
Executable file → Normal file
0
Daemons/netsocket/HWpoweroff
Normal file → Executable file
0
Daemons/netsocket/HWpoweroff
Normal file → Executable file
0
Daemons/netsocket/HWpoweron
Normal file → Executable file
0
Daemons/netsocket/HWpoweron
Normal file → Executable file
0
Daemons/netsocket/MOUNTpoweronoff
Normal file → Executable file
0
Daemons/netsocket/MOUNTpoweronoff
Normal file → Executable file
Binary file not shown.
0
Docs/Alignment/makelist
Normal file → Executable file
0
Docs/Alignment/makelist
Normal file → Executable file
0
Docs/focus
Normal file → Executable file
0
Docs/focus
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user