mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-22 15:55:48 +03:00
Fixed GPS speed
This commit is contained in:
parent
7fab6b93c8
commit
d366af00c6
1 changed files with 3 additions and 3 deletions
|
@ -193,15 +193,15 @@ void hottPrepareGPSResponse(HOTT_GPS_MSG_t *hottGPSMessage)
|
||||||
|
|
||||||
addGPSCoordinates(hottGPSMessage, GPS_coord[LAT], GPS_coord[LON]);
|
addGPSCoordinates(hottGPSMessage, GPS_coord[LAT], GPS_coord[LON]);
|
||||||
|
|
||||||
// GPS Speed in km/h
|
// GPS Speed is returned in cm/s (from io/gps.c) and must be sent in km/h (Hott requirement)
|
||||||
uint16_t speed = (GPS_speed * 36) / 100; // 0->1m/s * 0->36 = km/h
|
const uint16_t speed = (GPS_speed * 36) / 1000;
|
||||||
hottGPSMessage->gps_speed_L = speed & 0x00FF;
|
hottGPSMessage->gps_speed_L = speed & 0x00FF;
|
||||||
hottGPSMessage->gps_speed_H = speed >> 8;
|
hottGPSMessage->gps_speed_H = speed >> 8;
|
||||||
|
|
||||||
hottGPSMessage->home_distance_L = GPS_distanceToHome & 0x00FF;
|
hottGPSMessage->home_distance_L = GPS_distanceToHome & 0x00FF;
|
||||||
hottGPSMessage->home_distance_H = GPS_distanceToHome >> 8;
|
hottGPSMessage->home_distance_H = GPS_distanceToHome >> 8;
|
||||||
|
|
||||||
uint16_t hottGpsAltitude = (GPS_altitude) + HOTT_GPS_ALTITUDE_OFFSET; // GPS_altitude in m ; offset = 500 -> O m
|
const uint16_t hottGpsAltitude = (GPS_altitude) + HOTT_GPS_ALTITUDE_OFFSET; // GPS_altitude in m ; offset = 500 -> O m
|
||||||
|
|
||||||
hottGPSMessage->altitude_L = hottGpsAltitude & 0x00FF;
|
hottGPSMessage->altitude_L = hottGpsAltitude & 0x00FF;
|
||||||
hottGPSMessage->altitude_H = hottGpsAltitude >> 8;
|
hottGPSMessage->altitude_H = hottGpsAltitude >> 8;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue