Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
319c16f7
Commit
319c16f7
authored
Nov 05, 2013
by
Jeroen Vreeken
Browse files
Remove deprecated httptrace.
Remove deprecated libnova based trackers Remove unused float32_t union definitions
parent
bfce523d
Changes
6
Hide whitespace changes
Inline
Side-by-side
console/console/Makefile
View file @
319c16f7
...
...
@@ -18,7 +18,6 @@ all: lib/libaa.la lib/libpredict.la \
setpoint.o console_joystick command_shell
\
spg_list spg_log_parser
\
console_moontracker
\
console_httptrace
\
trace_proxy trace.cgi_install trace_log
\
console_j2000tracker console_j2000tracer console_j2000_indi
\
log_proxy spg_auth console_idle console_zenith
\
...
...
@@ -36,8 +35,6 @@ release: $(RELEASE_FILE)
await_controller
:
await_controller.o
console_httptrace
:
console_httptrace.o
console_joystick
:
console_joystick.o setpoint.o
command_shell
:
command_shell.o setpoint.o
...
...
@@ -131,7 +128,6 @@ clean:
command_shell
\
console_joystick
\
console_dt_model
\
console_httptrace
\
console_manual
\
console_moontracker
\
console_suntracker
\
...
...
console/console/console_azel.c
View file @
319c16f7
...
...
@@ -50,11 +50,6 @@ int go = 0;
float
sp_az
=
0
;
float
sp_el
=
0
;
typedef
union
{
uint32_t
u
;
float
f
;
}
float32_t
;
int
handle_cmd
(
char
*
command
)
{
...
...
console/console/console_httptrace.c
deleted
100644 → 0
View file @
bfce523d
/*
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2007
Copyright Stichting C.A. Muller Radioastronomiestation, 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<netinet/in.h>
#include
<string.h>
#include
<math.h>
#include
<time.h>
#include
<tcp_connect.h>
typedef
union
{
float
f
;
uint32_t
u
;
}
float32_t
;
time_t
starttime
;
float
step
=
1
.
0
/
10
.
0
;
#define VAL_BUFLEN (60 * 10)
FILE
*
fdplot
=
NULL
;
int
doplot
=
0
;
struct
trace
{
int
fd
;
float
val
;
char
*
trace_name
;
char
*
trace_unit
;
double
bufpos_time
;
time_t
seconds
;
int
sample
;
int
wasnan
;
int
interval
;
float
period
;
};
#define VERSION "Camras_DT_ctrl/0.1 Console_httptrace/0.2"
#define BOUNDARY "BOUNDARY"
struct
trace
*
traces
;
void
handle_val
(
struct
trace
*
trace
,
float
val
,
time_t
seconds
,
int
sample
)
{
if
(
sample
%
trace
->
interval
==
0
)
{
trace
->
val
=
val
;
trace
->
bufpos_time
=
(
double
)
seconds
+
(
double
)
sample
*
trace
->
period
;
doplot
++
;
}
}
int
open_trace
(
struct
trace
*
trace
,
char
*
tracename
,
int
interval
)
{
char
name
[
100
];
char
prevname
[
100
];
int
len
=
0
;
int
ret
;
int
unit
=
0
;
float
period
;
memset
(
trace
,
0
,
sizeof
(
struct
trace
));
trace
->
fd
=
tcp_connect
(
"localhost"
,
10000
);
if
(
trace
->
fd
<
0
)
{
return
1
;
}
do
{
ret
=
read
(
trace
->
fd
,
name
+
len
,
1
);
if
(
ret
==
1
)
{
if
((
name
[
len
]
==
0
&&
unit
!=
2
)
||
(
len
==
4
&&
unit
==
2
))
{
if
(
len
==
0
)
break
;
switch
(
unit
)
{
case
0
:
strcpy
(
prevname
,
name
);
unit
++
;
break
;
case
1
:
if
(
!
strcmp
(
prevname
,
tracename
))
{
trace
->
trace_unit
=
malloc
(
len
+
1
);
if
(
!
trace
->
trace_unit
)
return
1
;
strcpy
(
trace
->
trace_unit
,
name
);
}
unit
++
;
break
;
case
2
:
{
float32_t
f32
;
f32
.
u
=
ntohl
(
*
(
uint32_t
*
)
name
);
period
=
f32
.
f
;
trace
->
period
=
period
;
trace
->
interval
=
((
1
.
0
/
period
)
/
interval
)
+
0
.
999
;
unit
=
0
;
break
;
}
}
len
=
-
1
;
}
len
++
;
if
(
len
>=
100
)
{
len
=
0
;
}
}
}
while
(
ret
==
1
);
write
(
trace
->
fd
,
tracename
,
strlen
(
tracename
)
+
1
);
trace
->
trace_name
=
tracename
;
return
0
;
}
int
get_val
(
struct
trace
*
trace
)
{
int
ret
;
uint32_t
nin
;
float
fin
;
float32_t
f32
;
ret
=
read
(
trace
->
fd
,
&
nin
,
sizeof
(
uint32_t
));
f32
.
u
=
ntohl
(
nin
);
fin
=
f32
.
f
;
if
(
trace
->
wasnan
)
{
trace
->
seconds
=
ntohl
(
nin
);
trace
->
sample
=
0
;
trace
->
wasnan
=
0
;
}
else
if
(
isnan
(
fin
))
{
trace
->
wasnan
=
1
;
}
else
{
handle_val
(
trace
,
fin
,
trace
->
seconds
,
trace
->
sample
);
trace
->
sample
++
;
}
if
(
ret
==
sizeof
(
float
))
return
0
;
else
return
-
1
;
}
void
plot_values
(
struct
trace
*
traces
,
int
nr_traces
)
{
int
i
,
r
;
printf
(
"Content-type: text/plain
\n\n
"
);
for
(
i
=
0
;
i
<
nr_traces
;
i
++
)
{
printf
(
"%f %e %s "
,
traces
[
i
].
bufpos_time
,
traces
[
i
].
val
,
traces
[
i
].
trace_unit
);
}
r
=
printf
(
"
\n
--%s
\n
"
,
BOUNDARY
);
if
(
r
<
0
)
exit
(
0
);
if
(
fflush
(
NULL
))
exit
(
0
);
return
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
i
,
ret
=
0
;
int
nrtraces
;
starttime
=
time
(
NULL
);
if
(
argc
<
5
)
{
printf
(
"usage: %s [host] [port] [update_freq] [trace1] ...
\n
"
,
argv
[
0
]);
}
nrtraces
=
argc
-
4
;
traces
=
malloc
(
sizeof
(
struct
trace
)
*
nrtraces
);
for
(
i
=
0
;
i
<
nrtraces
;
i
++
)
{
open_trace
(
&
traces
[
i
],
argv
[
i
+
4
],
atoi
(
argv
[
3
]));
}
printf
(
"Content-type: multipart/x-mixed-replace;boundary=%s
\n
"
,
BOUNDARY
);
printf
(
"Cache-Control: no-cache
\n
"
);
printf
(
"Pragma: no-cache
\n
"
);
printf
(
"
\n
"
);
printf
(
"--%s
\n
"
,
BOUNDARY
);
do
{
for
(
i
=
0
;
i
<
nrtraces
;
i
++
)
{
ret
=
get_val
(
&
traces
[
i
]);
if
(
ret
)
break
;
}
if
(
ret
==
0
)
{
if
(
doplot
==
nrtraces
)
{
plot_values
(
traces
,
nrtraces
);
doplot
=
0
;
}
}
}
while
(
ret
==
0
);
return
0
;
}
console/console/console_manual.c
View file @
319c16f7
...
...
@@ -50,11 +50,6 @@ int go = 0;
float
sp_az
=
0
;
float
sp_el
=
0
;
typedef
union
{
uint32_t
u
;
float
f
;
}
float32_t
;
int
handle_cmd
(
char
*
command
)
{
...
...
console/console/console_moontracker.libnova.c
deleted
100644 → 0
View file @
bfce523d
/*
Command generator for moon tracking
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2008
Copyright Stichting C.A. Muller Radioastronomiestation, 2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<time.h>
#include
<sys/time.h>
#include
<unistd.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<math.h>
#include
<string.h>
#include
<fcntl.h>
#include
<termios.h>
#include
<signal.h>
#include
<ctype.h>
#include
<inttypes.h>
#include
<arpa/inet.h>
#include
<sys/select.h>
#include
<sys/ioctl.h>
#include
<errno.h>
#include
<libnova/transform.h>
#include
<libnova/julian_day.h>
#include
<libnova/utility.h>
#include
<libnova/lunar.h>
#include
"setpoint.h"
#include
"tcp_connect.h"
#include
"tcp_listen.h"
char
*
command_host
=
"localhost"
;
int
command_port
=
11000
;
char
*
az_command_spg
=
"Azimuth_Setpoint"
;
char
*
el_command_spg
=
"Elevation_Setpoint"
;
typedef
union
{
uint32_t
u
;
float
f
;
}
float32_t
;
struct
lnh_lnlat_posn
dwingeloo
;
struct
ln_lnlat_posn
dwingeloo_pos
;
struct
ln_equ_posn
object
;
struct
ln_hms
track_hms
;
struct
ln_dms
track_dms
;
int
main
(
int
argc
,
char
**
argv
)
{
struct
setpoint_command
*
sp_command_az
=
NULL
;
struct
setpoint_command
*
sp_command_el
=
NULL
;
time_t
lastt
=
0
;
printf
(
"libnova version: %s
\n
"
,
ln_get_version
());
dwingeloo
.
lng
.
neg
=
0
;
dwingeloo
.
lng
.
degrees
=
6
;
dwingeloo
.
lng
.
minutes
=
23
;
dwingeloo
.
lng
.
seconds
=
46
.
21
;
dwingeloo
.
lat
.
neg
=
0
;
dwingeloo
.
lat
.
degrees
=
52
;
dwingeloo
.
lat
.
minutes
=
48
;
dwingeloo
.
lat
.
seconds
=
43
.
27
;
ln_hlnlat_to_lnlat
(
&
dwingeloo
,
&
dwingeloo_pos
);
signal
(
SIGPIPE
,
SIG_IGN
);
sp_command_az
=
setpoint_command_init
(
command_host
,
command_port
,
az_command_spg
,
"console/moontracker"
);
sp_command_el
=
setpoint_command_init
(
command_host
,
command_port
,
el_command_spg
,
"console/moontracker"
);
if
(
!
sp_command_az
||
!
sp_command_el
)
{
fprintf
(
stderr
,
"Setpoint generator(s) not found
\n
"
);
exit
(
-
1
);
}
while
(
1
)
{
time_t
t
;
struct
ln_date
date
;
double
JD
;
struct
ln_hrz_posn
hrz
;
t
=
time
(
NULL
);
if
(
t
!=
lastt
)
{
lastt
=
t
;
t
+=
20
;
ln_get_date_from_timet
(
&
t
,
&
date
);
JD
=
ln_get_julian_day
(
&
date
);
ln_get_lunar_equ_coords
(
JD
,
&
object
);
ln_deg_to_hms
(
object
.
ra
,
&
track_hms
);
ln_deg_to_dms
(
object
.
dec
,
&
track_dms
);
ln_get_hrz_from_equ
(
&
object
,
&
dwingeloo_pos
,
JD
,
&
hrz
);
/* libnova has an az range from 0 to 360 with 0 being South.
Dwingeloo has an az range from -270 to 270 with 0 being South
*/
if
(
hrz
.
az
>
180
.
0
)
hrz
.
az
-=
360
.
0
;
printf
(
"%s
\n
"
,
ctime
(
&
t
));
printf
(
"Setpoint: %02dh%02dm%04.1f %s%03dd%02dm%04.1f %d %f %f
\n
"
,
track_hms
.
hours
,
track_hms
.
minutes
,
track_hms
.
seconds
,
track_dms
.
neg
?
"-"
:
" "
,
track_dms
.
degrees
,
track_dms
.
minutes
,
track_dms
.
seconds
,
(
unsigned
int
)
t
,
hrz
.
az
,
hrz
.
alt
);
setpoint_command_setpoint_time
(
sp_command_az
,
hrz
.
az
*
2
*
M_PI
/
360
.
0
,
t
);
setpoint_command_setpoint_time
(
sp_command_el
,
hrz
.
alt
*
2
*
M_PI
/
360
.
0
,
t
);
sleep
(
1
);
}
}
}
console/console/console_suntracker.c.libnova
deleted
100644 → 0
View file @
bfce523d
/*
Command generator for sun tracking
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2008
Copyright Stichting C.A. Muller Radioastronomiestation, 2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <fcntl.h>
#include <termios.h>
#include <signal.h>
#include <ctype.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <errno.h>
#include "libnova/transform.h"
#include "libnova/julian_day.h"
#include "libnova/utility.h"
#include "libnova/solar.h"
#include "setpoint.h"
#include "tcp_connect.h"
#include "tcp_listen.h"
char *command_host = "localhost";
int command_port = 11000;
char *az_command_spg = "Azimuth_Setpoint";
char *el_command_spg = "Elevation_Setpoint";
typedef union {
uint32_t u;
float f;
} float32_t;
struct lnh_lnlat_posn dwingeloo;
struct ln_lnlat_posn dwingeloo_pos;
struct ln_equ_posn object;
struct ln_hms track_hms;
struct ln_dms track_dms;
int main(int argc, char **argv)
{
struct setpoint_command *sp_command_az = NULL;
struct setpoint_command *sp_command_el = NULL;
time_t lastt = 0;
printf("libnova version: %s\n", ln_get_version());
dwingeloo.lng.neg = 0;
dwingeloo.lng.degrees = 6;
dwingeloo.lng.minutes = 23;
dwingeloo.lng.seconds = 46.21;
dwingeloo.lat.neg = 0;
dwingeloo.lat.degrees = 52;
dwingeloo.lat.minutes = 48;
dwingeloo.lat.seconds = 43.27;
ln_hlnlat_to_lnlat(&dwingeloo, &dwingeloo_pos);
signal(SIGPIPE, SIG_IGN);
sp_command_az = setpoint_command_init(command_host, command_port,
az_command_spg, "console/suntracker");
sp_command_el = setpoint_command_init(command_host, command_port,
el_command_spg, "console/suntracker");
if (!sp_command_az || !sp_command_el) {
fprintf(stderr, "Setpoint generator(s) not found\n");
exit(-1);
}
while (1)
{
time_t t;
struct ln_date date;
double JD;
struct ln_hrz_posn hrz;
t = time(NULL);
if (t != lastt) {
lastt = t;
t += 20;
ln_get_date_from_timet(&t, &date);
JD = ln_get_julian_day(&date);
ln_get_solar_equ_coords(JD, &object);
ln_deg_to_hms(object.ra, &track_hms);
ln_deg_to_dms(object.dec, &track_dms);
ln_get_hrz_from_equ(&object, &dwingeloo_pos, JD, &hrz);
/* libnova has an az range from 0 to 360 with 0 being South.
Dwingeloo has an az range from -270 to 270 with 0 being South
*/
if (hrz.az > 180.0)
hrz.az -= 360.0;
printf("Setpoint: %02dh%02dm%04.1f %s%03dd%02dm%04.1f %d %f %f\n",
track_hms.hours, track_hms.minutes, track_hms.seconds,
track_dms.neg ? "-" : " ",
track_dms.degrees, track_dms.minutes, track_dms.seconds,
(unsigned int)t, hrz.az, hrz.alt);
setpoint_command_setpoint_time(sp_command_az,
hrz.az * 2 * M_PI / 360.0, t);
setpoint_command_setpoint_time(sp_command_el,
hrz.alt * 2 * M_PI / 360.0, t);
sleep(1);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment