Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
deltaflight
deltaflight
Commits
815de608
Commit
815de608
authored
Jun 24, 2015
by
Dominic Clifton
Browse files
Merge branch 'Netsplits-sport-telemetry'
parents
02240a73
13d923a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/telemetry/smartport.c
View file @
815de608
...
@@ -246,6 +246,7 @@ void configureSmartPortTelemetryPort(void)
...
@@ -246,6 +246,7 @@ void configureSmartPortTelemetryPort(void)
smartPortState
=
SPSTATE_INITIALIZED
;
smartPortState
=
SPSTATE_INITIALIZED
;
smartPortTelemetryEnabled
=
true
;
smartPortTelemetryEnabled
=
true
;
smartPortLastRequestTime
=
millis
();
}
}
bool
canSendSmartPortTelemetry
(
void
)
bool
canSendSmartPortTelemetry
(
void
)
...
@@ -348,19 +349,14 @@ void handleSmartPortTelemetry(void)
...
@@ -348,19 +349,14 @@ void handleSmartPortTelemetry(void)
// the MSB of the sent uint32_t helps FrSky keep track
// the MSB of the sent uint32_t helps FrSky keep track
// the even/odd bit of our counter helps us keep track
// the even/odd bit of our counter helps us keep track
if
(
smartPortIdCnt
&
1
)
{
if
(
smartPortIdCnt
&
1
)
{
tmpui
=
tmpi
=
GPS_coord
[
LON
];
tmpui
=
abs
(
GPS_coord
[
LON
]);
// now we have unsigned value and one bit to spare
if
(
tmpi
<
0
)
{
tmpui
=
(
tmpui
+
tmpui
/
2
)
/
25
|
0x80000000
;
// 6/100 = 1.5/25, division by power of 2 is fast
tmpui
=
-
tmpi
;
if
(
GPS_coord
[
LON
]
<
0
)
tmpui
|=
0x40000000
;
tmpui
|=
0x40000000
;
}
tmpui
|=
0x80000000
;
}
}
else
{
else
{
tmpui
=
tmpi
=
GPS_coord
[
LAT
];
tmpui
=
abs
(
GPS_coord
[
LAT
]);
// now we have unsigned value and one bit to spare
if
(
tmpi
<
0
)
{
tmpui
=
(
tmpui
+
tmpui
/
2
)
/
25
;
// 6/100 = 1.5/25, division by power of 2 is fast
tmpui
=
-
tmpi
;
if
(
GPS_coord
[
LAT
]
<
0
)
tmpui
|=
0x40000000
;
tmpui
|=
0x40000000
;
}
}
}
smartPortSendPackage
(
id
,
tmpui
);
smartPortSendPackage
(
id
,
tmpui
);
smartPortHasRequest
=
0
;
smartPortHasRequest
=
0
;
...
@@ -452,7 +448,7 @@ void handleSmartPortTelemetry(void)
...
@@ -452,7 +448,7 @@ void handleSmartPortTelemetry(void)
#ifdef GPS
#ifdef GPS
case
FSSP_DATAID_GPS_ALT
:
case
FSSP_DATAID_GPS_ALT
:
if
(
sensors
(
SENSOR_GPS
)
&&
STATE
(
GPS_FIX
))
{
if
(
sensors
(
SENSOR_GPS
)
&&
STATE
(
GPS_FIX
))
{
smartPortSendPackage
(
id
,
GPS_altitude
*
100
0
);
// given in 0.1m , requested in 10
0
= 1m
smartPortSendPackage
(
id
,
GPS_altitude
*
100
);
// given in 0.1m , requested in 10 = 1m
(should be in mm, probably a bug in opentx, tested on 2.0.1.7)
smartPortHasRequest
=
0
;
smartPortHasRequest
=
0
;
}
}
break
;
break
;
...
...
Write
Preview
Markdown
is supported
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