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
5f3aa23c
Commit
5f3aa23c
authored
Feb 20, 2013
by
Jeroen Vreeken
Browse files
prevent large moves
parent
f829ab49
Changes
3
Hide whitespace changes
Inline
Side-by-side
console/console/console_moontracker.c
View file @
5f3aa23c
...
...
@@ -359,6 +359,11 @@ int main(int argc, char **argv)
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
);
}
}
...
...
console/console/console_sattracker.c
View file @
5f3aa23c
...
...
@@ -67,7 +67,7 @@ char tle_str[139] =
struct
location
*
location
;
struct
predict
*
predict
=
NULL
;
void
set_tle
(
void
)
bool
set_tle
(
char
newtle
[
139
]
)
{
double
lat
,
lon
,
alt
;
...
...
@@ -76,14 +76,18 @@ void set_tle(void)
alt
=
location_get_altitude
(
location
);
printf
(
"Using lat: %f, lon: %f, alt: %f
\n
"
,
lat
,
lon
,
alt
);
if
(
predict_tle_check
(
tle
_str
))
{
if
(
predict_tle_check
(
new
tle
))
{
printf
(
"Invallid TLE
\n
"
);
return
;
return
false
;
}
strcpy
(
tle_str
,
newtle
);
if
(
predict
)
predict_free
(
predict
);
predict
=
predict_create
(
tle_str
,
lat
,
lon
,
alt
);
return
true
;
}
...
...
@@ -91,6 +95,7 @@ void set_tle(void)
bool
refraction_enable
=
false
;
bool
dt_model_enable
=
false
;
bool
switch_enabled
=
false
;
bool
switch_cmd
=
false
;
struct
compensation_switch
{
char
*
name
;
...
...
@@ -203,14 +208,20 @@ void handle_cmd(struct cmd_client *cmd)
printf
(
"found switch %s
\n
"
,
name
);
if
(
val
[
0
]
==
'1'
)
{
*
compensation_switches
[
i
].
value
=
true
;
if
(
!
strcmp
(
name
,
"enabled"
))
{
switch_cmd
=
true
;
}
}
else
{
*
compensation_switches
[
i
].
value
=
false
;
}
}
}
if
(
!
strcmp
(
name
,
"tle"
))
{
strcpy
(
tle_str
,
val
);
set_tle
();
char
newtle
[
139
];
strcpy
(
newtle
,
val
);
if
(
!
set_tle
(
newtle
))
switch_enabled
=
false
;
}
}
}
...
...
@@ -328,7 +339,7 @@ int main(int argc, char **argv)
alt
=
location_get_altitude
(
location
);
printf
(
"Using lat: %f, lon: %f, alt: %f
\n
"
,
lat
,
lon
,
alt
);
set_tle
();
set_tle
(
tle_str
);
signal
(
SIGPIPE
,
SIG_IGN
);
...
...
@@ -415,18 +426,17 @@ int main(int argc, char **argv)
/* check if we might have compensate 360 degrees to
prevent large az steps
*/
printf
(
"fabs(%f - %f): %f
\n
"
,
last_az
,
az
,
fabs
(
last_az
-
az
));
if
(
az
>
90
.
0
||
az
<
-
90
.
0
)
{
/* If the sat is very low,
don't bother swapping */
printf
(
"fabs(%f - %f): %f
\n
"
,
last_az
,
az
,
fabs
(
last_az
-
az
));
if
(
el
>
-
20
.
0
)
{
/* large step? */
if
(
fabs
(
last_az
-
az
)
>
200
.
0
)
{
printf
(
"Swapping AZ
\n
"
);
az
+=
copysign
(
360
.
0
,
last_az
);
}
/* large step? */
if
(
fabs
(
last_az
-
az
)
>
200
.
0
)
{
printf
(
"Swapping AZ
\n
"
);
az
+=
copysign
(
360
.
0
,
last_az
);
}
}
if
(
switch_cmd
&&
fabs
(
last_az
-
az
)
>
180
.
0
)
{
switch_enabled
=
false
;
}
last_az
=
az
;
...
...
@@ -444,6 +454,7 @@ int main(int argc, char **argv)
setpoint_command_speed
(
sp_command_az
,
0
.
0
);
setpoint_command_speed
(
sp_command_el
,
0
.
0
);
}
switch_cmd
=
false
;
}
FD_ZERO
(
&
fdset_rx
);
...
...
console/console/console_suntracker.c
View file @
5f3aa23c
...
...
@@ -354,6 +354,11 @@ int main(int argc, char **argv)
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
);
}
}
...
...
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