Commit b194d009 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Fix swapping if already high

parent c3e2eac7
......@@ -424,6 +424,7 @@ int main(int argc, char **argv)
struct timeval tv;
double pressure, temperature;
double alt_adj;
bool check_swap = false;
t = time(NULL);
if (t != lastt) {
......@@ -437,7 +438,7 @@ int main(int argc, char **argv)
predict_calc_azel(predict, JD, &az, &el);
/* predict has an az range from 0 to 360 with 0 being South.
/* predict has an az range from 0 to 360 with 0 being North.
Dwingeloo has an az range from -270 to 270 with 0 being South
*/
az -= 180.0;
......@@ -453,6 +454,7 @@ int main(int argc, char **argv)
az, az_aos);
az += copysign(360.0, az_aos);
}
check_swap = check_az;
check_az = false;
}
if (el >= EL_HORIZON) {
......@@ -467,9 +469,14 @@ int main(int argc, char **argv)
log_send(LOG_T_DEBUG,
"Swapping AZ");
az += copysign(360.0, last_az);
if (check_swap && (az > 270.0 || az < -270.0)) {
log_send(LOG_T_DEBUG, "Swap not possible!");
az -= copysign(360.0, last_az);
}
}
}
passknown = false;
check_swap = false;
}
if (t > t_los)
......
......@@ -164,10 +164,10 @@ function dt_status(element_name) {
val = rad2deg(val);
var val_n = val + 180;
if (val >= 360)
val -= 360;
if (val < 0)
val += 360;
if (val_n >= 360)
val_n -= 360;
if (val_n < 0)
val_n += 360;
val_nd = val_n.toFixed(4);
dt_status_this.val_az_north.value_set(val_nd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment