1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 23:05:19 +03:00

CF/BF - OSD - Show symbol for GPS speed to better align with altitude

display on OSD.  Name and extract the duplicated GPS_speed equation - in
CM/S to KM/H.
This commit is contained in:
Hydra 2017-03-08 21:31:58 +00:00 committed by Dominic Clifton
parent c40c507f1b
commit 636c194aea
2 changed files with 5 additions and 2 deletions

View file

@ -35,6 +35,8 @@
#define DECIDEGREES_TO_RADIANS(angle) ((angle / 10.0f) * 0.0174532925f) #define DECIDEGREES_TO_RADIANS(angle) ((angle / 10.0f) * 0.0174532925f)
#define DEGREES_TO_RADIANS(angle) ((angle) * 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 MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x)) #define ABS(x) ((x) > 0 ? (x) : -(x))

View file

@ -220,7 +220,8 @@ static void osdDrawSingleElement(uint8_t item)
case OSD_GPS_SPEED: 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; break;
} }
#endif // GPS #endif // GPS
@ -637,7 +638,7 @@ static void osdUpdateStats(void)
{ {
int16_t value = 0; int16_t value = 0;
#ifdef GPS #ifdef GPS
value = GPS_speed * 36 / 1000; value = CM_S_TO_KM_H(GPS_speed);
#endif #endif
if (stats.max_speed < value) if (stats.max_speed < value)
stats.max_speed = value; stats.max_speed = value;