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
b21607f6
Commit
b21607f6
authored
Feb 06, 2014
by
Jeroen Vreeken
Browse files
Merge branch 'jeroen' into ui
parents
eff036e1
f4fcc974
Changes
51
Hide whitespace changes
Inline
Side-by-side
common/include/controller_setpoint_command.h
0 → 120000
View file @
b21607f6
..
/
..
/
controller
/
controller
/
controller_setpoint_command
.
h
\ No newline at end of file
common/utils/Makefile
View file @
b21607f6
...
...
@@ -11,7 +11,7 @@ LIBUTILOBJS= $(UTILSRCS:.c=.lo)
all
:
$(LIBUTILOBJS) weather_test libutils.la libutils.la_install
libutils.la_LDFLAGS
=
-lm
-rpath
${CURDIR}
/../lib
libutils.la_LDFLAGS
=
-lm
-rpath
${CURDIR}
/../lib
-lrt
libutils.la
:
$(LIBUTILOBJS)
${CURDIR}/../lib
:
...
...
console/console/Makefile
View file @
b21607f6
include
../build.mk
CFLAGS
=
-Wall
-
g
-I
../../common/utils
\
CFLAGS
=
-Wall
-
O3
-I
../../common/utils
\
-I
../controller
\
-Iaalib
-Ipredictlib
\
-I
../../common/trace
\
...
...
@@ -8,7 +8,7 @@ CFLAGS= -Wall -g -I../../common/utils \
-I
../../common/log
\
-I
../../include
LDFLAGS
+=
-L
../../common/lib/
-L
../../lib/
-L
./lib
-lutils
-ltrace
-static
-llog
LDFLAGS
+=
-L
../../common/lib/
-L
../../lib/
-L
./lib
-lutils
-ltrace
-llog
LIBNOVA
=
-lnova
-L
../../lib/
...
...
console/console/console_sattracker.c
View file @
b21607f6
...
...
@@ -53,6 +53,10 @@
#include
"log.h"
#define TIME_OFFSET 2
#define EL_HORIZON -1.0
#define NEXTPASS_RANGE_T (3600 * 24)
#define COORD_NR 50
char
*
command_host
=
"localhost"
;
int
command_port
=
CONSOLE_COMMAND_PORT
;
...
...
@@ -64,32 +68,191 @@ char *el_command_spg = "Elevation_Setpoint";
char
tle_str
[
139
]
=
"1 25544U 98067A 11346.36157800 .00019501 00000-0 25689-3 0 6081"
"2 25544 51.6432 344.3748 0024836 155.4957 344.3191 15.58092544748721"
;
char
*
name
=
NULL
;
struct
location
*
location
;
struct
predict
*
predict
=
NULL
;
bool
set_tle
(
char
newtle
[
139
])
static
bool
passknown
=
false
;
time_t
delay
;
static
double
az_aos
=
0
;
static
time_t
t_aos
;
static
time_t
t_los
;
struct
status_server
*
stat_srv
;
void
nextpass
(
struct
predict
*
predict
)
{
time_t
t
,
tnow
=
time
(
NULL
);
double
JD
;
struct
ln_date
date
;
int
i
;
double
prev_az
,
az
,
el
;
bool
aos
=
false
,
los
=
false
;
bool
cross_west
=
false
,
cross_east
=
false
;
int
t_west_1
=
0
,
t_east_1
=
0
,
t_west_2
=
0
,
t_east_2
=
0
;
time_t
t_step
;
char
statline
[
2000
];
char
*
statlinepos
;
if
(
delay
>
tnow
)
return
;
for
(
i
=
TIME_OFFSET
;
i
<
NEXTPASS_RANGE_T
;
i
++
)
{
t
=
tnow
+
i
;
ln_get_date_from_timet
(
&
t
,
&
date
);
JD
=
ln_get_julian_day
(
&
date
);
predict_calc_azel
(
predict
,
JD
,
&
az
,
&
el
);
az
-=
180
.
0
;
if
(
el
>=
EL_HORIZON
&&
!
aos
)
{
log_send
(
LOG_T_INFO
,
"Next pass starts in %d seconds, az=%f"
,
i
,
az
);
aos
=
true
;
prev_az
=
az
;
az_aos
=
az
;
t_aos
=
tnow
+
i
;
}
if
(
el
<
EL_HORIZON
&&
aos
)
{
log_send
(
LOG_T_INFO
,
"Next pass ends in %d seconds"
,
i
);
los
=
true
;
t_los
=
tnow
+
i
;
break
;
}
if
(
aos
&&
!
los
)
{
// printf("%d az: %f\n", (int)t, az);
/* this is a pass */
if
(
az
<
-
90
.
0
&&
prev_az
>
90
.
0
)
{
/* crossed north */
prev_az
-=
360
.
0
;
}
if
(
az
>
90
.
0
&&
prev_az
<
-
90
.
0
)
{
/* crossed north */
prev_az
+=
360
.
0
;
}
if
(
az
<=
90
.
0
&&
prev_az
>
90
.
0
)
cross_west
=
true
;
if
(
az
>=
-
90
.
0
&&
prev_az
<
-
90
.
0
)
cross_east
=
true
;
if
(
cross_east
)
{
t_west_2
++
;
}
else
{
t_west_1
++
;
}
if
(
cross_west
)
{
t_east_2
++
;
}
else
{
t_east_1
++
;
}
}
}
if
(
!
aos
)
{
log_send
(
LOG_T_WARNING
,
"No pass within %d seconds, will calculate again after %d seconds"
,
NEXTPASS_RANGE_T
,
NEXTPASS_RANGE_T
/
2
);
delay
=
tnow
+
NEXTPASS_RANGE_T
/
2
;
if
(
stat_srv
)
status_server_send
(
stat_srv
,
"pass=unknown
\n
"
);
return
;
}
delay
=
0
;
log_send
(
LOG_T_INFO
,
"cross_west: %d, cross_east: %d, t_w_1: %d, t_w_2: %d, t_e_1: %d, t_e_2: %d"
,
cross_west
,
cross_east
,
t_west_1
,
t_west_2
,
t_east_1
,
t_east_2
);
if
(
t_west_1
>=
t_west_2
&&
t_west_1
>=
t_east_1
&&
t_west_1
>=
t_east_2
)
{
/* if we begin with start az we might go through east late */
if
(
az_aos
<
-
90
)
{
az_aos
+=
360
;
}
}
else
if
(
t_west_2
>=
t_west_1
&&
t_west_2
>=
t_east_1
&&
t_west_2
>=
t_east_2
)
{
/* if we begin with start az we go through east in wrong way first */
az_aos
+=
360
;
}
else
if
(
t_east_1
>=
t_west_1
&&
t_east_1
>=
t_west_2
&&
t_east_1
>=
t_east_2
)
{
/* if we begin with start az we might go through west late */
if
(
az_aos
>
90
)
{
az_aos
-=
360
;
}
}
else
{
az_aos
-=
360
;
}
if
(
az_aos
>
270
.
0
)
az_aos
=
270
.
0
;
if
(
az_aos
<
-
270
.
0
)
az_aos
=
-
270
.
0
;
t_step
=
(
t_los
-
t_aos
)
/
COORD_NR
;
if
(
!
t_step
)
t_step
=
1
;
statlinepos
=
statline
;
statlinepos
+=
sprintf
(
statlinepos
,
"pass="
);
for
(
i
=
t_aos
;
i
<
t_los
;
i
+=
t_step
)
{
t
=
i
;
ln_get_date_from_timet
(
&
t
,
&
date
);
JD
=
ln_get_julian_day
(
&
date
);
predict_calc_azel
(
predict
,
JD
,
&
az
,
&
el
);
az
-=
180
.
0
;
statlinepos
+=
sprintf
(
statlinepos
,
"%lld:%d:%d "
,
(
long
long
)
t
,
(
int
)
round
(
az
),
(
int
)
round
(
el
));
}
sprintf
(
statlinepos
,
"
\n
"
);
if
(
stat_srv
)
status_server_send
(
stat_srv
,
statline
);
passknown
=
true
;
}
bool
set_tle
(
char
*
newtle
)
{
double
lat
,
lon
,
alt
;
char
processed_tle
[
139
];
char
*
new_name
;
lat
=
location_get_latitude
(
location
);
lon
=
location_get_longitude
(
location
);
alt
=
location_get_altitude
(
location
);
printf
(
"Using lat: %f, lon: %f, alt: %f
\n
"
,
lat
,
lon
,
alt
);
log_send
(
LOG_T_DEBUG
,
"Using lat: %f, lon: %f, alt: %f"
,
lat
,
lon
,
alt
);
if
(
predict_tle_check
(
newtle
))
{
printf
(
"Invallid TLE
\n
"
);
if
(
predict_tle_check
(
newtle
,
processed_tle
,
&
new_name
))
{
log_send
(
LOG_T_ERROR
,
"Invallid TLE"
);
return
false
;
}
strcpy
(
tle_str
,
newtle
);
strncpy
(
tle_str
,
processed_tle
,
139
);
if
(
name
)
{
free
(
name
);
name
=
NULL
;
}
if
(
new_name
)
name
=
new_name
;
else
name
=
strdup
(
"unknown"
);
log_send
(
LOG_T_INFO
,
"Switching to new TLE for satellite '%s'"
,
name
?
name
:
"unknown"
);
if
(
predict
)
predict_free
(
predict
);
predict
=
predict_create
(
tle_str
,
lat
,
lon
,
alt
);
log_send
(
LOG_T_INFO
,
"Switching to new TLE"
);
passknown
=
false
;
delay
=
0
;
nextpass
(
predict
);
return
true
;
}
...
...
@@ -128,10 +291,10 @@ int handle_cmd(char *name, char *val)
{
int
i
;
printf
(
"name %s value %s
\n
"
,
name
,
val
);
log_send
(
LOG_T_DEBUG
,
"name %s value %s"
,
name
,
val
);
for
(
i
=
0
;
compensation_switches
[
i
].
name
;
i
++
)
{
if
(
!
strcmp
(
name
,
compensation_switches
[
i
].
name
))
{
printf
(
"found switch %s
\n
"
,
name
);
log_send
(
LOG_T_DEBUG
,
"found switch %s"
,
name
);
if
(
val
[
0
]
==
'1'
)
{
*
compensation_switches
[
i
].
value
=
true
;
if
(
!
strcmp
(
name
,
"enabled"
))
{
...
...
@@ -143,10 +306,7 @@ int handle_cmd(char *name, char *val)
}
}
if
(
!
strcmp
(
name
,
"tle"
))
{
char
newtle
[
139
];
strcpy
(
newtle
,
val
);
if
(
!
set_tle
(
newtle
))
if
(
!
set_tle
(
val
))
switch_enabled
=
false
;
}
...
...
@@ -167,11 +327,6 @@ void output(struct status_server *stat_srv)
last
=
now
;
// printf("Trace %f %f : %02dh%02dm%04.1f %s%03dd%02dm%04.1f\n",
// hrz.az, hrz.alt,
// hms.hours, hms.minutes, hms.seconds,
// dms.neg ? "-" : " ", dms.degrees, dms.minutes, dms.seconds);
statlinepos
=
statline
;
for
(
i
=
0
;
compensation_switches
[
i
].
name
;
i
++
)
{
if
(
i
)
{
...
...
@@ -184,6 +339,10 @@ void output(struct status_server *stat_srv)
*
compensation_switches
[
i
].
value
);
statlinepos
+=
ret
;
}
if
(
name
)
{
ret
=
sprintf
(
statlinepos
,
",name=%s"
,
name
);
statlinepos
+=
ret
;
}
sprintf
(
statlinepos
,
",tle=%s
\n
"
,
tle_str
);
status_server_send
(
stat_srv
,
statline
);
...
...
@@ -195,9 +354,7 @@ int main(int argc, char **argv)
struct
setpoint_command
*
sp_command_az
=
NULL
;
struct
setpoint_command
*
sp_command_el
=
NULL
;
struct
command_server
*
cmd_srv
;
struct
status_server
*
stat_srv
;
time_t
lastt
=
0
;
double
lat
,
lon
,
alt
;
double
last_az
=
0
.
0
;
dt_model_init
();
...
...
@@ -208,10 +365,6 @@ int main(int argc, char **argv)
return
-
1
;
}
lat
=
location_get_latitude
(
location
);
lon
=
location_get_longitude
(
location
);
alt
=
location_get_altitude
(
location
);
printf
(
"Using lat: %f, lon: %f, alt: %f
\n
"
,
lat
,
lon
,
alt
);
set_tle
(
tle_str
);
...
...
@@ -229,25 +382,29 @@ int main(int argc, char **argv)
sp_command_el
=
setpoint_command_init
(
command_host
,
command_port
,
el_command_spg
,
"console/sattracker"
);
if
(
!
sp_command_az
||
!
sp_command_el
)
{
fprintf
(
stderr
,
"Setpoint generator(s) not found
\n
"
);
log_send
(
LOG_T_ERROR
,
"Setpoint generator(s) not found"
);
exit
(
-
1
);
}
cmd_srv
=
command_server_create
(
cmd_port
,
0
,
100
);
if
(
!
cmd_srv
)
{
printf
(
"Could not open listen port for commands
\n
"
);
log_send
(
LOG_T_ERROR
,
"Could not open listen port for commands"
);
return
-
1
;
}
else
{
command_server_handler_set
(
cmd_srv
,
handle_cmd
);
}
stat_srv
=
status_server_create
(
stat_port
,
0
,
100
);
if
(
!
cmd_srv
)
{
printf
(
"Could not open listen port for status
\n
"
);
if
(
!
stat_srv
)
{
log_send
(
LOG_T_ERROR
,
"Could not open listen port for status"
);
return
-
1
;
}
weather
=
weather_create
(
"Dwingeloo"
);
if
(
!
weather
)
{
fprintf
(
stderr
,
"Could not create weather handle
\n
"
);
log_send
(
LOG_T_ERROR
,
"Could not create weather handle"
);
exit
(
-
1
);
}
...
...
@@ -274,43 +431,64 @@ 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.
Dwingeloo has an az range from -270 to 270 with 0 being South
*/
az
-=
180
.
0
;
if
(
el
<
EL_HORIZON
)
{
if
(
!
passknown
)
nextpass
(
predict
);
/* large step? */
if
(
fabs
(
az_aos
-
az
)
>
180
.
0
)
{
log_send
(
LOG_T_DEBUG
,
"Preset to aos position %f -> %f"
,
az
,
az_aos
);
az
+=
copysign
(
360
.
0
,
az_aos
);
}
}
else
{
/* check if we might have to compensate 360
degrees to prevent large az steps
*/
log_send
(
LOG_T_DEBUG
,
"fabs(%f - %f): %f"
,
last_az
,
az
,
fabs
(
last_az
-
az
));
if
(
az
>
90
.
0
||
az
<
-
90
.
0
)
{
/* large step? */
if
(
fabs
(
last_az
-
az
)
>
200
.
0
)
{
log_send
(
LOG_T_DEBUG
,
"Swapping AZ"
);
az
+=
copysign
(
360
.
0
,
last_az
);
}
}
passknown
=
false
;
}
if
(
t
>
t_los
)
passknown
=
false
;
if
(
refraction_enable
)
{
/* Get current weather */
temperature
=
weather_get_temperature
(
weather
);
pressure
=
weather_get_pressure
(
weather
);
/* Refraction adjustment */
alt_adj
=
ln_get_refraction_adj
(
el
,
pressure
,
temperature
);
printf
(
"Refraction: %f @ %fC,%fmbar
\n
"
,
alt_adj
,
temperature
,
pressure
);
log_send
(
LOG_T_DEBUG
,
"Refraction: %f @ %fC,%fmbar"
,
alt_adj
,
temperature
,
pressure
);
el
+=
alt_adj
;
}
/* 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
*/
az
-=
180
.
0
;
if
(
dt_model_enable
)
{
double
daz
,
del
;
daz
=
dt_model_azimuth_delta
(
az
,
el
);
del
=
dt_model_elevation_delta
(
az
,
el
);
printf
(
"model: %g %g
\n
"
,
daz
,
del
);
log_send
(
LOG_T_DEBUG
,
"model: %g %g"
,
daz
,
del
);
az
+=
daz
;
el
+=
del
;
}
/* 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
)
{
/* 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
)
{
if
(
!
switch_cmd
&&
fabs
(
last_az
-
az
)
>
90
.
0
)
{
if
(
switch_enabled
)
log_send
(
LOG_T_WARNING
,
"Disabling tracker to prevent large azimuth jump"
);
...
...
@@ -319,7 +497,11 @@ int main(int argc, char **argv)
last_az
=
az
;
printf
(
"Setpoint: %d %f %f %f
\n
"
,
/* Temporary limit on elevation */
if
(
el
<
0
.
0
)
el
=
0
.
0
;
log_send
(
LOG_T_DEBUG
,
"Setpoint: %d %f %f %f"
,
(
unsigned
int
)
t
,
JD
,
az
,
el
);
if
(
switch_enabled
)
{
...
...
console/console/predictlib/predictlib.c
View file @
b21607f6
...
...
@@ -179,9 +179,45 @@ struct predict *predict_create(char *tle, double lat, double lon, double alt)
return
predict
;
}
bool
predict_tle_check
(
char
*
tle
)
bool
predict_tle_check
(
char
*
tle
,
char
processed_tle
[
139
],
char
**
name
)
{
return
!
Good_Elements
(
tle
);
char
tmp_tle
[
strlen
(
tle
)
+
1
];
int
i
;
strcpy
(
tmp_tle
,
tle
);
for
(
i
=
0
;
i
<
strlen
(
tmp_tle
);
i
++
)
{
if
(
tmp_tle
[
i
]
==
'\n'
||
tmp_tle
[
i
]
==
'\r'
)
{
strcpy
(
tmp_tle
+
i
,
tmp_tle
+
i
+
1
);
i
--
;
}
}
for
(
i
=
0
;
i
<
(
int
)
strlen
(
tmp_tle
)
-
137
;
i
++
)
{
if
(
Good_Elements
(
tmp_tle
+
i
))
{
if
(
processed_tle
)
{
memcpy
(
processed_tle
,
tmp_tle
+
i
,
138
);
processed_tle
[
138
]
=
0
;
}
if
(
name
&&
i
)
{
*
name
=
malloc
(
i
+
1
);
if
(
*
name
)
{
memcpy
(
*
name
,
tmp_tle
,
i
);
(
*
name
)[
i
]
=
0
;
while
(
i
&&
(
(
*
name
)[
i
-
1
]
==
' '
||
(
*
name
)[
i
-
1
]
==
'\t'
))
{
(
*
name
)[
i
-
1
]
=
0
;
i
--
;
}
}
}
else
{
*
name
=
NULL
;
}
return
false
;
}
}
return
true
;
}
void
predict_free
(
struct
predict
*
predict
)
...
...
console/console/predictlib/predictlib.h
View file @
b21607f6
...
...
@@ -5,7 +5,7 @@
struct
predict
;
bool
predict_tle_check
(
char
*
tle
);
bool
predict_tle_check
(
char
*
tle
,
char
processed_tle
[
138
],
char
**
name
);
struct
predict
*
predict_create
(
char
*
tle
,
double
lat
,
double
lon
,
double
alt
);
...
...
console/console/setpoint.c
View file @
b21607f6
...
...
@@ -143,13 +143,19 @@ struct setpoint_command *setpoint_command_init(char *host, int port,
int
setpoint_command_setpoint
(
struct
setpoint_command
*
sp_cmd
,
float
sp
)
{
int
ret
;
unsigned
char
command
[
4
];
unsigned
char
arg
[
4
];
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
command
;
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
arg
;
f32_t
f
;
*
(
uint32_t
*
)
command
=
htonl
(
BLOCK_SPG_SETPOINT
);
command
.
u32
=
htonl
(
BLOCK_SPG_SETPOINT
);
f
.
f
=
sp
;
*
(
uint32_t
*
)
arg
=
htonl
(
f
.
u
);
arg
.
u32
=
htonl
(
f
.
u
);
if
(
sp_cmd
->
fd
<
0
)
{
sleep
(
1
);
...
...
@@ -160,13 +166,13 @@ int setpoint_command_setpoint(struct setpoint_command *sp_cmd, float sp)
return
1
;
}
ret
=
write
(
sp_cmd
->
fd
,
command
,
4
);
ret
=
write
(
sp_cmd
->
fd
,
command
.
c
,
4
);
if
(
ret
!=
4
)
{
printf
(
"Connection to controller command socket lost.
\n
"
);
close
(
sp_cmd
->
fd
);
sp_cmd
->
fd
=
-
1
;
}
else
{
ret
=
write
(
sp_cmd
->
fd
,
arg
,
4
);
ret
=
write
(
sp_cmd
->
fd
,
arg
.
c
,
4
);
if
(
ret
!=
4
)
{
printf
(
"Connection to controller command socket lost.
\n
"
);
close
(
sp_cmd
->
fd
);
...
...
@@ -180,13 +186,19 @@ int setpoint_command_setpoint(struct setpoint_command *sp_cmd, float sp)
int
setpoint_command_speed
(
struct
setpoint_command
*
sp_cmd
,
float
speed
)
{
int
ret
;
unsigned
char
command
[
4
];
unsigned
char
arg
[
4
];
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
command
;
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
arg
;
f32_t
f
;
*
(
uint32_t
*
)
command
=
htonl
(
BLOCK_SPG_SPEED
);
command
.
u32
=
htonl
(
BLOCK_SPG_SPEED
);
f
.
f
=
speed
;
*
(
uint32_t
*
)
arg
=
htonl
(
f
.
u
);
arg
.
u32
=
htonl
(
f
.
u
);
if
(
sp_cmd
->
fd
<
0
)
{
sleep
(
1
);
...
...
@@ -197,13 +209,13 @@ int setpoint_command_speed(struct setpoint_command *sp_cmd, float speed)
return
1
;
}
ret
=
write
(
sp_cmd
->
fd
,
command
,
4
);
ret
=
write
(
sp_cmd
->
fd
,
command
.
c
,
4
);
if
(
ret
!=
4
)
{
printf
(
"Connection to controller command socket lost.
\n
"
);
close
(
sp_cmd
->
fd
);
sp_cmd
->
fd
=
-
1
;
}
else
{
ret
=
write
(
sp_cmd
->
fd
,
arg
,
4
);
ret
=
write
(
sp_cmd
->
fd
,
arg
.
c
,
4
);
if
(
ret
!=
4
)
{
printf
(
"Connection to controller command socket lost.
\n
"
);
close
(
sp_cmd
->
fd
);
...
...
@@ -218,14 +230,20 @@ int setpoint_command_setpoint_time(struct setpoint_command *sp_cmd,
float
sp
,
time_t
sptime
)
{
int
ret
;
unsigned
char
command
[
4
];
unsigned
char
arg
[
8
];
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
command
;
union
{
unsigned
char
c
[
4
];
uint32_t
u32
;
}
arg
[
2
];
f32_t
f
;
*
(
uint32_t
*
)
command
=
htonl
(
BLOCK_SPG_SETPOINT_TIME
);
command
.
u32
=
htonl
(
BLOCK_SPG_SETPOINT_TIME
);
f
.
f
=
sp
;
*
(
uint32_t
*
)
arg
=
htonl
(
f
.
u
);
*
(
uint32_t
*
)
&
arg
[
4
]
=
htonl
(
sptime
);
arg
[
0
].
u32
=
htonl
(
f
.
u
);
arg
[
1
].
u32
=
htonl
(
sptime
);
if
(
sp_cmd
->
fd
<
0
)
{
sleep
(
1
);
...
...
@@ -236,13 +254,13 @@ int setpoint_command_setpoint_time(struct setpoint_command *sp_cmd,
return
1
;
}
ret
=
write
(
sp_cmd
->
fd
,
command
,
4
);
ret
=
write
(
sp_cmd
->
fd
,
command
.
c
,
4
);
if
(
ret
!=
4
)
{