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
b0d4e78a
Commit
b0d4e78a
authored
Jun 18, 2013
by
Jeroen Vreeken
Browse files
Disable moon and sun tracker when crossing north.
parent
c13c14d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
console/console/console_moontracker.c
View file @
b0d4e78a
...
...
@@ -48,9 +48,11 @@
#include
"dt_model.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
#include
"command_server.h"
#include
"status_server.h"
#include
"log.h"
char
*
command_host
=
"localhost"
;
int
command_port
=
CONSOLE_COMMAND_PORT
;
...
...
@@ -144,11 +146,15 @@ int main(int argc, char **argv)
struct
command_server
*
cmd_srv
;
struct
status_server
*
stat_srv
;
struct
weather
*
weather
;
double
az
,
el
,
prev_az
;
time_t
lastt
=
0
;
signal
(
SIGPIPE
,
SIG_IGN
);
log_client_start
(
dt_host_console
(),
CONSOLE_LOG_PORT_IN
,
LOG_T_DEBUG
,
LOG_T_INFO
,
"console/moontracker"
);
do
{
sp_command_az
=
setpoint_command_init
(
command_host
,
command_port
,
az_command_spg
,
"console/moontracker"
);
...
...
@@ -194,7 +200,6 @@ int main(int argc, char **argv)
int
high
=
0
;
fd_set
fdset_rx
;
struct
timeval
tv
;
double
az
,
el
;
t
=
time
(
NULL
);
if
(
t
!=
lastt
)
{
...
...
@@ -225,16 +230,24 @@ int main(int argc, char **argv)
}
if
(
switch_enabled
)
{
setpoint_command_setpoint_time
(
sp_command_az
,
az
*
2
*
M_PI
/
360
.
0
,
t
);
setpoint_command_setpoint_time
(
sp_command_el
,
el
*
2
*
M_PI
/
360
.
0
,
t
);
/* Detect 'jump' at north crossing */
if
(
fabs
(
prev_az
-
az
)
>
180
.
0
)
{
log_send
(
LOG_T_WARNING
,
"Disabling tracker to prevent large azimuth jump"
);
switch_enabled
=
false
;
}
else
{
setpoint_command_setpoint_time
(
sp_command_az
,
az
*
2
*
M_PI
/
360
.
0
,
t
);
setpoint_command_setpoint_time
(
sp_command_el
,
el
*
2
*
M_PI
/
360
.
0
,
t
);
}
}
else
{
/* not enabled, send idle just in case we were
still moving */
setpoint_command_speed
(
sp_command_az
,
0
.
0
);
setpoint_command_speed
(
sp_command_el
,
0
.
0
);
}
prev_az
=
az
;
}
FD_ZERO
(
&
fdset_rx
);
...
...
console/console/console_suntracker.c
View file @
b0d4e78a
...
...
@@ -48,9 +48,10 @@
#include
"dt_model.h"
#include
"dt_port_numbers.h"
#include
"dt_host.h"
#include
"command_server.h"
#include
"status_server.h"
#include
"log.h"
char
*
command_host
=
"localhost"
;
...
...
@@ -143,11 +144,15 @@ int main(int argc, char **argv)
struct
weather
*
weather
;
struct
command_server
*
cmd_srv
;
struct
status_server
*
stat_srv
;
double
az
,
el
,
prev_az
;
time_t
lastt
=
0
;
signal
(
SIGPIPE
,
SIG_IGN
);
log_client_start
(
dt_host_console
(),
CONSOLE_LOG_PORT_IN
,
LOG_T_DEBUG
,
LOG_T_INFO
,
"console/suntracker"
);
do
{
sp_command_az
=
setpoint_command_init
(
command_host
,
command_port
,
az_command_spg
,
"console/suntracker"
);
...
...
@@ -189,7 +194,6 @@ int main(int argc, char **argv)
while
(
1
)
{
time_t
t
;
double
az
,
el
;
int
high
=
0
;
fd_set
fdset_rx
;
struct
timeval
tv
;
...
...
@@ -221,16 +225,24 @@ int main(int argc, char **argv)
}
if
(
switch_enabled
)
{
setpoint_command_setpoint_time
(
sp_command_az
,
az
*
2
*
M_PI
/
360
.
0
,
t
);
setpoint_command_setpoint_time
(
sp_command_el
,
el
*
2
*
M_PI
/
360
.
0
,
t
);
/* Detect 'jump' at north crossing */
if
(
fabs
(
prev_az
-
az
)
>
180
.
0
)
{
log_send
(
LOG_T_WARNING
,
"Disabling tracker to prevent large azimuth jump"
);
switch_enabled
=
false
;
}
else
{
setpoint_command_setpoint_time
(
sp_command_az
,
az
*
2
*
M_PI
/
360
.
0
,
t
);
setpoint_command_setpoint_time
(
sp_command_el
,
el
*
2
*
M_PI
/
360
.
0
,
t
);
}
}
else
{
/* not enabled, send idle just in case we were
still moving */
setpoint_command_speed
(
sp_command_az
,
0
.
0
);
setpoint_command_speed
(
sp_command_el
,
0
.
0
);
}
prev_az
=
az
;
}
FD_ZERO
(
&
fdset_rx
);
...
...
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