diff --git a/src/frsky.cpp b/src/frsky.cpp index ecd8fbcbd..0a1c1e435 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -572,8 +572,8 @@ void resetTelemetry() #ifdef FRSKY_HUB uint16_t sqrt32(uint32_t n) { - unsigned int c = 0x8000; - unsigned int g = 0x8000; + uint16_t c = 0x8000; + uint32_t g = 0x8000; for(;;) { if(g*g > n) @@ -617,7 +617,7 @@ uint32_t getGpsDistanceX2() return result; } -uint32_t getGpsDistance() +uint16_t getGpsDistance() { return (frskyHubData.pilotLatitude ? sqrt32(getGpsDistanceX2()) : 0); } diff --git a/src/frsky.h b/src/frsky.h index de2dc5525..54ebd1418 100644 --- a/src/frsky.h +++ b/src/frsky.h @@ -158,7 +158,7 @@ void resetTelemetry(); #ifdef FRSKY_HUB void getGpsPilotPosition(); uint32_t getGpsDistanceX2(); -uint32_t getGpsDistance(); +uint16_t getGpsDistance(); #endif #endif