diff --git a/src/main/common/maths.h b/src/main/common/maths.h index e21dfb0426..807be800b8 100644 --- a/src/main/common/maths.h +++ b/src/main/common/maths.h @@ -35,6 +35,8 @@ #define DECIDEGREES_TO_RADIANS(angle) ((angle / 10.0f) * 0.0174532925f) #define DEGREES_TO_RADIANS(angle) ((angle) * 0.0174532925f) +#define CM_S_TO_KM_H(centimetersPerSecond) (centimetersPerSecond * 36 / 1000) + #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABS(x) ((x) > 0 ? (x) : -(x)) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 4825bab577..79e4b415b6 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -220,7 +220,8 @@ static void osdDrawSingleElement(uint8_t item) case OSD_GPS_SPEED: { - sprintf(buff, "%d%c", GPS_speed * 36 / 1000, SYM_MS); + // FIXME ideally we want to use SYM_KMH symbol but it's not in the font any more, so we use K. + sprintf(buff, "%dK", CM_S_TO_KM_H(GPS_speed) * 10); break; } #endif // GPS @@ -637,7 +638,7 @@ static void osdUpdateStats(void) { int16_t value = 0; #ifdef GPS - value = GPS_speed * 36 / 1000; + value = CM_S_TO_KM_H(GPS_speed); #endif if (stats.max_speed < value) stats.max_speed = value;