From 8aa86c25cf0791a7baf6c2ce7a0db87c78620986 Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Sat, 26 Oct 2019 19:36:25 -0400 Subject: [PATCH] Fix data type overflow in HDOP calculation in Smartport telemetry Calculation used uint8_t which overflowed and corrupted the satellite count portion of the telemetry value. --- src/main/telemetry/smartport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/telemetry/smartport.c b/src/main/telemetry/smartport.c index 774bd98db..890e7480e 100644 --- a/src/main/telemetry/smartport.c +++ b/src/main/telemetry/smartport.c @@ -763,7 +763,7 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear #ifdef USE_GPS if (sensors(SENSOR_GPS)) { // satellite accuracy HDOP: 0 = worst [HDOP > 5.5m], 9 = best [HDOP <= 1.0m] - uint8_t hdop = constrain(scaleRange(gpsSol.hdop, 100, 550, 9, 0), 0, 9) * 100; + uint16_t hdop = constrain(scaleRange(gpsSol.hdop, 100, 550, 9, 0), 0, 9) * 100; smartPortSendPackage(id, (STATE(GPS_FIX) ? 1000 : 0) + (STATE(GPS_FIX_HOME) ? 2000 : 0) + hdop + gpsSol.numSat); *clearToSend = false; } else if (featureIsEnabled(FEATURE_GPS)) {