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
98c5c7c7
Commit
98c5c7c7
authored
Sep 29, 2015
by
Jeroen Vreeken
Browse files
Various fixes for tracing and command handling.
parent
d69c23a4
Changes
8
Hide whitespace changes
Inline
Side-by-side
common/command/.gitignore
View file @
98c5c7c7
command_joystick
command_list
command_send
common/command/command_joystick
deleted
100755 → 0
View file @
d69c23a4
File deleted
common/trace/trace_dump.c
View file @
98c5c7c7
/*
Copyright Jeroen Vreeken (
pe1rxq@amsat.org
), 2007, 2008, 2011, 2013
Copyright Jeroen Vreeken (
jeroen@vreeken.net
), 2007, 2008, 2011, 2013
, 2015
Copyright Stichting C.A. Muller Radioastronomiestation, 2007, 2008, 2011
This program is free software: you can redistribute it and/or modify
...
...
@@ -28,6 +28,9 @@
#include
<trace/trace.h>
//#define DEBUG_TIMESTAMP
//#define DEBUG_INTERVAL
struct
timespec
t_int
;
char
*
tracename
;
...
...
@@ -35,7 +38,9 @@ static void handler_interval(struct trace *trace,
struct
timespec
*
interval
,
enum
trace_interval_type
type
)
{
memcpy
(
&
t_int
,
interval
,
sizeof
(
struct
timespec
));
#ifdef DEBUG_INTERVAL
printf
(
"interval: %ld.%09ld
\n
"
,
interval
->
tv_sec
,
interval
->
tv_nsec
);
#endif
}
int
cnt
=
0
;
...
...
@@ -43,7 +48,9 @@ int cnt =0;
static
void
handler_timestamp
(
struct
trace
*
trace
,
struct
timespec
*
t
)
{
#ifdef DEBUG_TIMESTAMP
printf
(
"timestamp: %ld.%09ld, cnt=%d
\n
"
,
t
->
tv_sec
,
t
->
tv_nsec
,
cnt
);
#endif
cnt
=
0
;
}
...
...
@@ -170,6 +177,8 @@ int main(int argc, char **argv)
trace_packet_put
(
pkt
);
}
trace_autorecover
(
trace
,
true
);
printf
(
"Wait for data
\n
"
);
while
(
trace_state_get
(
trace
)
==
TRACE_STATE_RECEIVING
||
...
...
console/console/console_httpd.c
View file @
98c5c7c7
...
...
@@ -475,11 +475,11 @@ static void start_trace(struct libwebsocket *wsi, int freq, char *variable)
if
(
freq
)
{
uint64_t
nsec
;
nsec
=
1000000000
/
freq
;
nsec
=
1000000000
ull
/
freq
;
type
=
TRACE_INTERVAL_TYPE_INTERVAL
;
t_int
.
tv_sec
=
nsec
/
1000000000
;
t_int
.
tv_nsec
=
nsec
-
t_int
.
tv_sec
*
1000000000
;
t_int
.
tv_sec
=
nsec
/
1000000000
ull
;
t_int
.
tv_nsec
=
nsec
-
(
uint64_t
)
t_int
.
tv_sec
*
1000000000
ull
;
t_int
.
tv_sec
=
0
;
t_int
.
tv_nsec
=
500000000
;
...
...
console/console/spg_auth.c
View file @
98c5c7c7
...
...
@@ -383,7 +383,10 @@ int main (int argc, char **argv)
try_command
(
client
->
command
);
}
}
for
(
i
=
0
;
i
<
spgs_nr
;
i
++
)
{
command_fd_set
(
spgs
[
i
].
spg_cmd
,
&
fd_rd
,
&
high
);
}
select
(
high
+
1
,
&
fd_rd
,
NULL
,
NULL
,
&
timeout
);
if
(
FD_ISSET
(
fd_listen
,
&
fd_rd
))
{
...
...
@@ -394,6 +397,10 @@ int main (int argc, char **argv)
command_server_fdset_handle
(
offset_srv
,
&
fd_rd
);
command_server_fdset_handle
(
console_srv
,
&
fd_rd
);
for
(
i
=
0
;
i
<
spgs_nr
;
i
++
)
{
command_handle
(
spgs
[
i
].
spg_cmd
,
&
fd_rd
);
}
for
(
client
=
clients
,
clientp
=
&
clients
;
client
;
client
=
*
clientp
)
{
if
(
!
client
->
pending
)
command_handle
(
client
->
command
,
&
fd_rd
);
...
...
console/console/trace_proxy.c
View file @
98c5c7c7
...
...
@@ -21,6 +21,7 @@
#include
<utils/dt_host.h>
#include
<trace/trace.h>
#include
<log/log.h>
#include
<utils/tcp_listen.h>
#include
<stdio.h>
...
...
@@ -63,9 +64,9 @@ static void common_denom(struct timespec *common, struct timespec *int1, struct
uint64_t
d1
,
d2
;
uint64_t
inew
;
i1
=
int1
->
tv_sec
*
1000000000
+
int1
->
tv_nsec
;
i2
=
int2
->
tv_sec
*
1000000000
+
int2
->
tv_nsec
;
b
=
base_interval
.
tv_sec
*
1000000000
+
base_interval
.
tv_nsec
;
i1
=
(
uint64_t
)
int1
->
tv_sec
*
1000000000
ull
+
(
uint64_t
)
int1
->
tv_nsec
;
i2
=
(
uint64_t
)
int2
->
tv_sec
*
1000000000
ull
+
(
uint64_t
)
int2
->
tv_nsec
;
b
=
(
uint64_t
)
base_interval
.
tv_sec
*
1000000000
ull
+
(
uint64_t
)
base_interval
.
tv_nsec
;
if
(
!
b
)
{
memcpy
(
common
,
int1
,
sizeof
(
struct
timespec
));
return
;
...
...
@@ -73,7 +74,7 @@ static void common_denom(struct timespec *common, struct timespec *int1, struct
d1
=
i1
/
b
;
d2
=
i2
/
b
;
if
(
d1
==
d2
)
{
inew
=
d1
;
}
else
if
(
d2
&&
d1
>
d2
&&
!
(
d1
%
d2
))
{
...
...
@@ -90,9 +91,8 @@ static void common_denom(struct timespec *common, struct timespec *int1, struct
}
common
->
tv_sec
=
base_interval
.
tv_sec
*
inew
;
common
->
tv_nsec
=
base_interval
.
tv_nsec
*
inew
;
common
->
tv_sec
+=
common
->
tv_nsec
/
1000000000
;
common
->
tv_nsec
%=
1000000000
;
common
->
tv_nsec
=
((
uint64_t
)
base_interval
.
tv_nsec
*
inew
)
%
1000000000ull
;
common
->
tv_sec
+=
((
uint64_t
)
base_interval
.
tv_nsec
*
inew
)
/
1000000000ull
;
}
static
void
server_interval_check
(
struct
trace
*
server
)
...
...
@@ -145,7 +145,6 @@ static void server_interval_check(struct trace *server)
if
((
server
->
interval_type
!=
type
)
||
(
server
->
interval
.
tv_sec
!=
interval
.
tv_sec
)
||
(
server
->
interval
.
tv_nsec
!=
interval
.
tv_nsec
))
{
struct
trace_pkt
*
pkt
;
printf
(
"Changing server trace %s from %ld.%09ld, %d to %ld.%09ld, %d
\n
"
,
server
->
name
,
...
...
@@ -153,11 +152,7 @@ static void server_interval_check(struct trace *server)
server
->
interval_type
,
interval
.
tv_sec
,
interval
.
tv_nsec
,
type
);
pkt
=
trace_packet_new
();
trace_packet_interval_set
(
pkt
,
&
interval
,
type
);
trace_packet_write
(
server
,
pkt
);
trace_packet_put
(
pkt
);
trace_interval_set
(
server
,
&
interval
,
type
);
}
}
...
...
@@ -516,7 +511,10 @@ int main (int argc, char **argv)
fd_set
fd_rd
;
struct
trace
*
list
;
int
high
,
i
,
j
;
log_client_start
(
dt_host_console
(),
CONSOLE_LOG_PORT_IN
,
LOG_T_DEBUG
,
LOG_T_INFO
,
"trace_proxy"
);
fd_listen
=
tcp_listen
(
CONSOLE_TRACE_PORT
,
0
,
100
);
if
(
fd_listen
<
0
)
{
printf
(
"Could not open listen port %d
\n
"
,
CONSOLE_TRACE_PORT
);
...
...
console/js/dt_ui.js
View file @
98c5c7c7
...
...
@@ -538,6 +538,34 @@ dt_ui_text.prototype.oninput_set = function(func)
this
.
element
.
oninput
=
func
;
}
function
dt_ui_range
(
elementid
)
{
this
.
element
=
document
.
createElement
(
"
input
"
);
this
.
element
.
type
=
"
range
"
;
this
.
element
.
id
=
elementid
;
dt_ui_element
.
call
(
this
,
elementid
);
this
.
element
.
max
=
100
;
this
.
element
.
min
=
0
;
this
.
element
.
defaultValue
=
0
;
}
dt_ui_range
.
prototype
=
new
dt_ui_element
();
dt_ui_range
.
prototype
.
min_set
=
function
(
min
)
{
this
.
element
.
min
=
min
;
}
dt_ui_range
.
prototype
.
max_set
=
function
(
max
)
{
this
.
element
.
max
=
max
;
}
dt_ui_range
.
prototype
.
default_set
=
function
(
val
)
{
this
.
element
.
defaultValue
=
val
;
}
dt_ui_range
.
prototype
.
value_get
=
function
()
{
return
this
.
element
.
value
;
}
function
dt_ui_textarea
(
elementid
)
{
...
...
controller/block/block_pid_aw.c
View file @
98c5c7c7
...
...
@@ -102,7 +102,6 @@ static void pid_aw_calculate(struct controller_block *pid)
outp
=
0
;
outi
=
0
;
outd
=
0
;
priv
->
previous
=
0
;
}
priv
->
outp
=
outp
;
...
...
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