Fix data type overflow in HDOP calculation in Smartport telemet… (#9112)

Fix data type overflow in HDOP calculation in Smartport telemetry
This commit is contained in:
Michael Keller 2019-10-28 18:56:19 +13:00 committed by GitHub
commit de768751b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)) {