Commit 815de608 authored by Dominic Clifton's avatar Dominic Clifton
Browse files

Merge branch 'Netsplits-sport-telemetry'

parents 02240a73 13d923a9
...@@ -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 * 1000); // given in 0.1m , requested in 100 = 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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment