mirror of
https://github.com/eddyem/small_tel.git
synced 2026-11-22 13:40:17 +03:00
more fixes, not all yet
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
|
||||
#include "angles.h"
|
||||
|
||||
static placeData_t place = {.slong = -0.7232763200, .slat = 0.7618977414, .salt = 2070.};
|
||||
// in ERFA library east longitudes are POSITIVE (but in 10micron they are negative)
|
||||
static placeData_t place = {.slong = 0.7232763200, .slat = 0.7618977414, .salt = 2070.};
|
||||
static almDut_t AlmDut = {0};
|
||||
|
||||
// set/get polar/DUT1 data
|
||||
@@ -82,6 +83,7 @@ void getPlaceData(placeData_t *pd){
|
||||
*pd = place;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief ra2str - convert RA to string form "HH:MM:SS.SS"
|
||||
* @param ra - RA (hours)
|
||||
@@ -117,6 +119,7 @@ char *dec2str(double dec, char buf[RADEC_STR_MAXLEN]){
|
||||
buf[RADEC_STR_MAXLEN-1] = 0;
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
// normalize azimuth to [0, 360.) and z.d. to [0, 90]
|
||||
// if z>90 || z<-90 return false; if z < 0 rotate azimuth to 180
|
||||
@@ -239,34 +242,38 @@ void eq2hor(polarCrds_t *pc, horizCrds_t *h, double sidTime){
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief r2sHMS - convert angle in radians into string "'HH:MM:SS.SS'"
|
||||
* @brief r2sHMS - convert angle in radians into string "HH:MM:SS.SS"
|
||||
* @param radians - angle
|
||||
* @param hms (o) - string
|
||||
* @param len - length of hms
|
||||
* @param buf (o) - string
|
||||
*/
|
||||
void r2sHMS(double radians, char *hms, int len){
|
||||
void r2sHMS(double radians, char buf[RADEC_STR_MAXLEN]){
|
||||
char pm;
|
||||
int i[4];
|
||||
eraA2tf(2, radians, &pm, i);
|
||||
snprintf(hms, len, "'%c%02d:%02d:%02d.%02d'", pm, i[0],i[1],i[2],i[3]);
|
||||
size_t l = snprintf(buf, RADEC_STR_MAXLEN, "%c%02d:%02d:%02d.%02d", pm, i[0],i[1],i[2],i[3]);
|
||||
if(l >= RADEC_STR_MAXLEN) buf[RADEC_STR_MAXLEN-1] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief r2sDMS - convert angle in radians into string "'DD:MM:SS.S'"
|
||||
* @brief r2sDMS - convert angle in radians into string "DD:MM:SS.S"
|
||||
* @param radians - angle
|
||||
* @param dms (o) - string
|
||||
* @param len - length of hms
|
||||
* @param buf (o) - string
|
||||
*/
|
||||
void r2sDMS(double radians, char *dms, int len){
|
||||
void r2sDMS(double radians, char buf[RADEC_STR_MAXLEN]){
|
||||
char pm;
|
||||
int i[4];
|
||||
eraA2af(1, radians, &pm, i);
|
||||
snprintf(dms, len, "%c%02d:%02d:%02d.%d", pm, i[0],i[1],i[2],i[3]);
|
||||
size_t l = snprintf(buf, RADEC_STR_MAXLEN, "%c%02d:%02d:%02d.%d", pm, i[0],i[1],i[2],i[3]);
|
||||
if(l >= RADEC_STR_MAXLEN) buf[RADEC_STR_MAXLEN-1] = 0;
|
||||
}
|
||||
// the same, but argument in degrees
|
||||
void d2sDMS(double degrees, char *dms, int len){
|
||||
void d2sDMS(double degrees, char buf[RADEC_STR_MAXLEN]){
|
||||
double radians = DEG2RAD(degrees);
|
||||
return r2sDMS(radians, dms, len);
|
||||
r2sDMS(radians, buf);
|
||||
}
|
||||
void h2sHMS(double hours, char buf[RADEC_STR_MAXLEN]){
|
||||
double radians = HRS2RAD(hours);
|
||||
r2sHMS(radians, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,8 +64,10 @@ typedef struct{
|
||||
double py;
|
||||
} almDut_t;
|
||||
|
||||
#if 0
|
||||
char *ra2str(double ra, char buf[RADEC_STR_MAXLEN]);
|
||||
char *dec2str(double dec, char buf[RADEC_STR_MAXLEN]);
|
||||
#endif
|
||||
bool str2coord(const char *str, double *val);
|
||||
bool normAZ(double *a, double *z);
|
||||
void norm_RA(double *ra);
|
||||
@@ -77,9 +79,10 @@ void hor2eq(horizCrds_t *h, polarCrds_t *pc, double sidTime);
|
||||
void eq2horH(polarCrds_t *pc, horizCrds_t *h);
|
||||
void eq2hor(polarCrds_t *pc, horizCrds_t *h, double sidTime);
|
||||
|
||||
void r2sHMS(double radians, char *hms, int len);
|
||||
void r2sDMS(double radians, char *hms, int len);
|
||||
void d2sDMS(double degrees, char *dms, int len);
|
||||
void r2sHMS(double radians, char buf[RADEC_STR_MAXLEN]);
|
||||
void r2sDMS(double radians, char buf[RADEC_STR_MAXLEN]);
|
||||
void d2sDMS(double degrees, char buf[RADEC_STR_MAXLEN]);
|
||||
void h2sHMS(double hours, char buf[RADEC_STR_MAXLEN]);
|
||||
|
||||
bool get_MJDt(struct timeval *tval, sMJD_t *MJD);
|
||||
bool get_LST(sMJD_t *mjd, double *LST);
|
||||
|
||||
@@ -108,22 +108,25 @@ void wrhdr(fitsheader_t *HDR){
|
||||
return;
|
||||
}
|
||||
fchmod(fd, 0644);
|
||||
char val[23];
|
||||
val[22] = 0;
|
||||
#define VALLEN 22
|
||||
#define CMNTLEN 51
|
||||
char val[VALLEN+1];
|
||||
char ang[RADEC_STR_MAXLEN], cmnt[CMNTLEN+1];
|
||||
val[VALLEN] = 0, cmnt[CMNTLEN] = 0;
|
||||
#define WRHDR(k, v, c) do{if(printhdr(fd, k, v, c)){goto returning;}}while(0)
|
||||
WRHDR("TIMESYS", "'UTC'", "Time system");
|
||||
WRHDR("ORIGIN", "'SAO RAS'", "Organization responsible for the data");
|
||||
WRHDR("MOUNTNAM", HDR->mountname, "Mount name");
|
||||
if(fabs(HDR->dut.px) > FLT_EPSILON){
|
||||
snprintf(val, 22, "%.10f", HDR->dut.px);
|
||||
snprintf(val, VALLEN, "%.10f", HDR->dut.px);
|
||||
WRHDR("POLARX", val, "IERS pole X coordinate, arcsec");
|
||||
}
|
||||
if(fabs(HDR->dut.py) > FLT_EPSILON){
|
||||
snprintf(val, 22, "%.10f", HDR->dut.py);
|
||||
snprintf(val, VALLEN, "%.10f", HDR->dut.py);
|
||||
WRHDR("POLARY", val, "IERS pole Y coordinate, arcsec");
|
||||
}
|
||||
if(fabs(HDR->dut.DUT1) > FLT_EPSILON){
|
||||
snprintf(val, 22, "%.10f", HDR->dut.DUT1);
|
||||
snprintf(val, VALLEN, "%.10f", HDR->dut.DUT1);
|
||||
WRHDR("DUT1", val, "IERS `UT1-UTC`, sec");
|
||||
}
|
||||
polarCrds_t polar;
|
||||
@@ -131,75 +134,98 @@ void wrhdr(fitsheader_t *HDR){
|
||||
double pt = mount_getInpCoords(&polar), ht = mount_getInpHor(&horiz);
|
||||
if(pt > ht){ // horcrds is older -> show polar
|
||||
if(curtime - pt < COORDS_OLD_T){
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(polar.ra));
|
||||
WRHDR("INPRA", val, "Input RA, degrees");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(polar.dec));
|
||||
WRHDR("INPDEC", val, "Input DEC, degrees");
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(polar.ra));
|
||||
r2sHMS(polar.ra, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Input RA, deg. (%s)", ang);
|
||||
WRHDR("INPRA", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(polar.dec));
|
||||
r2sDMS(polar.dec, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Input DEC, deg. (%s)", ang);
|
||||
WRHDR("INPDEC", val, cmnt);
|
||||
}
|
||||
}else{ // show horiz
|
||||
if(curtime - ht < COORDS_OLD_T){
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(horiz.az));
|
||||
WRHDR("INPAZ", val, "Input Azimuth, degrees");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(horiz.zd));
|
||||
WRHDR("INPZD", val, "Input Zenith dist., degrees");
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(horiz.az));
|
||||
r2sDMS(horiz.az, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Input Azimuth, deg. (%s)", ang);
|
||||
WRHDR("INPAZ", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(horiz.zd));
|
||||
r2sDMS(horiz.zd, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Input Zenith dist., deg. (%s)", ang);
|
||||
WRHDR("INPZD", val, cmnt);
|
||||
}
|
||||
}
|
||||
if(curtime - mount_getTagCoords(&polar) < COORDS_OLD_T){
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(polar.ra));
|
||||
WRHDR("TAGRA", val, "Target RA, degrees");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(polar.dec));
|
||||
WRHDR("TAGDEC", val, "Target DEC, degrees");
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(polar.ra));
|
||||
r2sHMS(polar.ra, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Target RA, deg. (%s)", ang);
|
||||
WRHDR("TAGRA", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(polar.dec));
|
||||
r2sDMS(polar.dec, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Target DEC, deg. (%s)", ang);
|
||||
WRHDR("TAGDEC", val, cmnt);
|
||||
}
|
||||
if(poweredON){
|
||||
snprintf(val, 22, "%.10f", RAD2HRS(HDR->polar.ra)); // convert RA to degrees
|
||||
WRHDR("RA", val, "Telescope right ascension, current epoch, deg");
|
||||
snprintf(val, 22, "%.10f", RAD2HRS(eraAnp(HDR->sidtime - HDR->polar.ra))); // hour angle
|
||||
WRHDR("HA", val, "Telescope hour angle, deg");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(HDR->polar.dec));
|
||||
WRHDR("DEC", val, "Telescope declination, current epoch, deg");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(HDR->altaz.az));
|
||||
WRHDR("AZ", val, "Telescope azimuth, deg");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(HDR->altaz.zd));
|
||||
WRHDR("ZD", val, "Telescope zenith distance, deg");
|
||||
snprintf(val, VALLEN, "%.10f", RAD2HRS(HDR->polar.ra)); // convert RA to degrees
|
||||
r2sHMS(HDR->polar.ra, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Telescope Right Ascension, deg. (%s)", ang);
|
||||
WRHDR("RA", val, cmnt);
|
||||
double ha = eraAnp(HDR->sidtime - HDR->polar.ra);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2HRS(ha)); // hour angle
|
||||
r2sHMS(ha, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Telescope Hour Angle, deg. (%s)", ang);
|
||||
WRHDR("HA", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(HDR->polar.dec));
|
||||
r2sDMS(HDR->polar.dec, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Telescope Declination, deg. (%s)", ang);
|
||||
WRHDR("DEC", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(HDR->altaz.az));
|
||||
r2sDMS(HDR->altaz.az, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Telescope Azimuth, deg. (%s)", ang);
|
||||
WRHDR("AZ", val, cmnt);
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(HDR->altaz.zd));
|
||||
r2sDMS(HDR->altaz.zd, ang);
|
||||
snprintf(cmnt, CMNTLEN, "Telescope Zenith Distance, deg. (%s)", ang);
|
||||
WRHDR("ZD", val, cmnt);
|
||||
}
|
||||
WRHDR("TELSTAT", mount_status_str(HDR->status), "Telescope mount status");
|
||||
double mjd;
|
||||
mount_getInpEpoch(&mjd);
|
||||
if(mjd > 0.) snprintf(val, 22, "%.10f", 2000.+(mjd - ERFA_DJM00)/365.25); // calculate EPOCH/EQUINOX
|
||||
else snprintf(val, 22, "%.10f", 2000.+(HDR->MJD.MJD - ERFA_DJM00)/365.25);
|
||||
double epoch;
|
||||
mount_getInpEpoch(&epoch);
|
||||
if(epoch > 0.) snprintf(val, VALLEN, "%.8f", epoch); // calculate EPOCH/EQUINOX
|
||||
else snprintf(val, VALLEN, "%.10f", 2000.+(HDR->MJD.MJD - ERFA_DJM00)/365.25);
|
||||
WRHDR("INPEQUIN", val, "Equinox of input celestial coordinate system");
|
||||
if(poweredON){
|
||||
snprintf(val, 22, "%.10f", 2000.+(HDR->MJD.MJD - ERFA_DJM00)/365.25); // telescope coordinates: JNOW
|
||||
snprintf(val, VALLEN, "%.10f", 2000.+(HDR->MJD.MJD - ERFA_DJM00)/365.25); // telescope coordinates: JNOW
|
||||
WRHDR("EQUINOX", val, "Equinox of telescope celestial coordinate sys.");
|
||||
snprintf(val, 22, "%.10f", HDR->MJD.MJD);
|
||||
snprintf(val, VALLEN, "%.10f", HDR->MJD.MJD);
|
||||
WRHDR("MJD", val, "Modified Julian date of file creation");
|
||||
if(*HDR->pierside) WRHDR("PIERSIDE", HDR->pierside, "Pier side of telescope mount");
|
||||
}
|
||||
snprintf(val, 22, "%.1f", HDR->place.salt);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->place.salt);
|
||||
WRHDR("ELEVAT", val, "Elevation of site over the sea level");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(HDR->place.slong));
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(HDR->place.slong));
|
||||
WRHDR("LONGITUD", val, "Geo longitude of site (east negative)");
|
||||
snprintf(val, 22, "%.10f", RAD2DEG(HDR->place.slat));
|
||||
snprintf(val, VALLEN, "%.10f", RAD2DEG(HDR->place.slat));
|
||||
WRHDR("LATITUDE", val, "Geo latitude of site (south negative)");
|
||||
snprintf(val, 22, "%.6f", RAD2HRS(HDR->sidtime));
|
||||
snprintf(val, VALLEN, "%.6f", RAD2HRS(HDR->sidtime));
|
||||
WRHDR("LSTEND", val, "Local sidereal time of file creation");
|
||||
/* Weather data is written into separate header-file by weather daemon
|
||||
if(haveweather){
|
||||
snprintf(val, 22, "%.1f", HDR->weather.humidity);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.humidity);
|
||||
WRHDR("HUMIDITY", val, "Relative humidity, %%");
|
||||
snprintf(val, 22, "%.1f", HDR->weather.pressure);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.pressure);
|
||||
WRHDR("PRESSURE", val, "Atmospheric pressure, mmHg");
|
||||
snprintf(val, 22, "%.1f", HDR->weather.exttemp);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.exttemp);
|
||||
WRHDR("EXTTEMP", val, "External temperature, degrC");
|
||||
snprintf(val, 22, "%d", HDR->weather.rain);
|
||||
snprintf(val, VALLEN, "%d", HDR->weather.rain);
|
||||
WRHDR("RAIN", val, "Rain conditions");
|
||||
snprintf(val, 22, "%.1f", HDR->weather.clouds);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.clouds);
|
||||
WRHDR("SKYQUAL", val, "Sky quality (0 - wery bad, >2500 - good)");
|
||||
snprintf(val, 22, "%.1f", HDR->weather.wind);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.wind);
|
||||
WRHDR("WINDSPD", val, "Wind speed (m/s)");
|
||||
snprintf(val, 22, "%.1f", HDR->weather.windmax);
|
||||
snprintf(val, VALLEN, "%.1f", HDR->weather.windmax);
|
||||
WRHDR("WINDMAX", val, "Last hour maximal wind speed (m/s)");
|
||||
snprintf(val, 22, "%lld", (long long)HDR->weather.last_update);
|
||||
snprintf(val, VALLEN, "%lld", (long long)HDR->weather.last_update);
|
||||
WRHDR("WEATTIME", val, "Unix time of weather measurements");
|
||||
}*/
|
||||
// WRHDR("", , "");
|
||||
|
||||
@@ -278,16 +278,16 @@ static bool write_cmd(const char *cmd, bool haveanswer){
|
||||
if(!haveanswer){
|
||||
DBG("Command '%s'", cmd);
|
||||
if(!mount_dev || !cmd){
|
||||
DBG("no mount device?");
|
||||
WARNX("no mount device?");
|
||||
return false;
|
||||
}
|
||||
if(sl_tty_write(mount_dev->comfd, cmd, strlen(cmd))){
|
||||
DBG("Error writing request '%s'", cmd);
|
||||
WARNX("Error writing request '%s'", cmd);
|
||||
return false;
|
||||
}
|
||||
while(sl_tty_read(mount_dev) > 0);
|
||||
}else if(!send_cmd_resp(cmd, buf, 128)){
|
||||
DBG("Error writing command '%s'", cmd);
|
||||
WARNX("Error writing command '%s'", cmd);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -376,7 +376,10 @@ static bool guess_speed(){
|
||||
// connect to mount
|
||||
bool mount_connect(){
|
||||
if(isemulated) return true;
|
||||
if(!mount_dev) return false;
|
||||
if(!mount_dev){
|
||||
WARNX("Mount not initialized!");
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_lock(&mntdev_mutex);
|
||||
if(!chkconn() && !guess_speed()){
|
||||
pthread_mutex_unlock(&mntdev_mutex);
|
||||
@@ -419,12 +422,15 @@ void mount_disconnect(){
|
||||
bool mount_point(double ra, double dec){
|
||||
char rastr[RADEC_STR_MAXLEN], decstr[RADEC_STR_MAXLEN];
|
||||
norm_RADEC(&ra, &dec);
|
||||
ra2str(ra, rastr);
|
||||
dec2str(dec, decstr);
|
||||
h2sHMS(ra, rastr);
|
||||
d2sDMS(dec, decstr);
|
||||
LOGDBG("try to set RA/DEC to %s/%s", rastr, decstr);
|
||||
DBG("Set RA/Decl to %s/%s", rastr, decstr);
|
||||
LOGMSG("Try to set RA/Decl to %s/%s", rastr, decstr);
|
||||
if(isemulated) return point_emulation(ra, dec);
|
||||
if(!mount_dev) return false;
|
||||
if(!mount_dev){
|
||||
WARNX("No mount device!");
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_lock(&mntdev_mutex);
|
||||
char cmd[128];
|
||||
bool ret = false;
|
||||
@@ -443,6 +449,7 @@ bool mount_point(double ra, double dec){
|
||||
TagCoords.ra = HRS2RAD(ra);
|
||||
TagCoords.dec = DEG2RAD(dec);
|
||||
TagTime = sl_dtime();
|
||||
LOGMSG("Go to RA/Decl: %s/%s", rastr, decstr);
|
||||
retn:
|
||||
pthread_mutex_unlock(&mntdev_mutex);
|
||||
return ret;
|
||||
@@ -460,8 +467,8 @@ bool mount_pointAZ(double A, double Z){
|
||||
DBG("Wrong Z?");
|
||||
return false;
|
||||
}
|
||||
d2sDMS(A, azstr, RADEC_STR_MAXLEN);
|
||||
d2sDMS(90. - Z, altstr, RADEC_STR_MAXLEN);
|
||||
d2sDMS(A, azstr);
|
||||
d2sDMS(90. - Z, altstr);
|
||||
DBG("Point to stationary object, Az=%s, Alt=%s", azstr, altstr);
|
||||
if(isemulated){
|
||||
return pointAZ_emulation(A, Z);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
device = /dev/ttyS1
|
||||
serspeed = 9600 # starting speed after powering on
|
||||
logfile = loghere.log
|
||||
hdrfile = fitshdr.fits
|
||||
logfile = /tmp/stlog.log
|
||||
hdrfile = /tmp/fitshdr.fits
|
||||
dut1 = -0.021
|
||||
polarx = 0.1774
|
||||
polary = 0.3264
|
||||
parka = 01:48:38
|
||||
parkz = 88:46:31
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 20.0.1, 2026-10-13T23:29:46. -->
|
||||
<!-- Written by QtCreator 20.0.1, 2026-10-15T00:52:00. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -267,11 +267,12 @@ static sl_sock_hresult_e cmd_gotord(_U_ sl_sock_t *c, _U_ sl_sock_hitem_t *item,
|
||||
double Epoch;
|
||||
mount_getInpEpoch(&Epoch);
|
||||
if(Epoch > 0.){
|
||||
LOGDBG("Convert ra=%ghrs, dec=%gdeg from epoch=%g", RAD2HRS(px.ra), RAD2DEG(px.dec), Epoch);
|
||||
if(!JXtoJnow(&px, &pnow, Epoch)) return RESULT_FAIL;
|
||||
}else pnow = px;
|
||||
double ra_h = RAD2HRS(pnow.ra);
|
||||
double dec_d = RAD2DEG(pnow.dec);
|
||||
LOGDBG("Client %d asks to point ra=%ghrs, dec=%gdeg", c->fd, ra_h, dec_d);
|
||||
LOGMSG("Client %d asks to point ra=%ghrs, dec=%gdeg", c->fd, ra_h, dec_d);
|
||||
if(!mount_point(ra_h, dec_d)) return RESULT_FAIL;
|
||||
return RESULT_OK;
|
||||
}
|
||||
@@ -599,7 +600,7 @@ void server_run(){
|
||||
LOGWARN("Can't connect to mount, will try to reconnect later");
|
||||
}
|
||||
DBG("While");
|
||||
double tcheck = 0., treconnect = sl_dtime();
|
||||
double tcheck = sl_dtime(), treconnect = 0.;
|
||||
time_t lastweathertime = 0;
|
||||
getPlaceData(&HDR.place);
|
||||
mount_get_name(HDR.mountname, MAX_HDR_STRLEN);
|
||||
@@ -664,7 +665,7 @@ void server_run(){
|
||||
if(mount_connect()){
|
||||
notlogged = true;
|
||||
WARNX("Mount is ON");
|
||||
}
|
||||
}else WARNX("Still can't connect");
|
||||
}
|
||||
}
|
||||
DBG("Current status: %s", mount_status_str(HDR.status));
|
||||
|
||||
@@ -131,7 +131,7 @@ static bool proc_data(uint8_t *data, ssize_t len){
|
||||
double tagRA = RA2HRS(ra), tagDec = DEC2DEG(dec);
|
||||
DBG("RA: %u (%g hrs), DEC: %d (%g degr)", ra, tagRA, dec, tagDec);
|
||||
LOGMSG("(stellarium) RA: %u (%g hrs), DEC: %d (%g degr)", ra, tagRA, dec, tagDec);
|
||||
return (mount_setInpRA(tagRA) && mount_setInpDec(tagDec) && mount_setInpEpoch(ERFA_DJM00));
|
||||
return (mount_setInpRA(tagRA) && mount_setInpDec(tagDec) && mount_setInpEpoch(2000.));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,19 +187,17 @@ static void *handle_socket(void *sockd){
|
||||
while(isrunning){
|
||||
fitsheader_t HDR;
|
||||
server_getheader(&HDR);
|
||||
/*
|
||||
/**/
|
||||
// convert from Jnow to J2000
|
||||
polarCrds_t Jn = {0}, J2000 = {0};
|
||||
Jn.ra = HRS2RAD(Rhrs);
|
||||
Jn.dec = DEG2RAD(Ddeg);
|
||||
if(!JnowtoJ2000(&Jn, &J2000)) break;
|
||||
polarCrds_t J2000 = {0};
|
||||
if(!JnowtoJ2000(&HDR.polar, &J2000)) break;
|
||||
//DBG("got : %g/%g", RA, Decl);
|
||||
dout.ra = htole32(RAD2RA(J2000.ra));
|
||||
dout.dec = (int32_t)htole32(RAD2DEC(J2000.dec));
|
||||
*/
|
||||
/*
|
||||
dout.ra = htole32(RAD2RA(HDR.polar.ra));
|
||||
dout.dec = (int32_t)htole32(RAD2DEC(HDR.polar.dec));
|
||||
/**/
|
||||
*/
|
||||
if(!send_data((uint8_t*)&dout, sizeof(outdata), sock)) break; // send data even in `off` state
|
||||
if(!sl_canread(sock)){
|
||||
sleep(1);
|
||||
|
||||
Reference in New Issue
Block a user