Merge pull request #1763 from mikeller/add_hott_alternate_speed_altitude

Added speed / altitude readings from vario / baro to HoTT, in case of no GPS fix.
This commit is contained in:
Michael Keller 2016-12-29 13:06:16 +13:00 committed by GitHub
commit 8c371d7b49
2 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,7 @@
#include "build/debug.h" #include "build/debug.h"
#include "common/axis.h" #include "common/axis.h"
#include "common/time.h"
#include "drivers/system.h" #include "drivers/system.h"
@ -73,6 +74,7 @@
#include "sensors/sensors.h" #include "sensors/sensors.h"
#include "sensors/battery.h" #include "sensors/battery.h"
#include "sensors/barometer.h"
#include "flight/pid.h" #include "flight/pid.h"
#include "flight/navigation.h" #include "flight/navigation.h"
@ -201,7 +203,12 @@ void hottPrepareGPSResponse(HOTT_GPS_MSG_t *hottGPSMessage)
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;
const uint16_t hottGpsAltitude = (GPS_altitude) + HOTT_GPS_ALTITUDE_OFFSET; // GPS_altitude in m ; offset = 500 -> O m uint16_t altitude = GPS_altitude;
if (!STATE(GPS_FIX)) {
altitude = baro.BaroAlt / 100;
}
const uint16_t hottGpsAltitude = (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;

View File

@ -33,6 +33,7 @@ extern "C" {
#include "sensors/sensors.h" #include "sensors/sensors.h"
#include "sensors/battery.h" #include "sensors/battery.h"
#include "sensors/barometer.h"
#include "io/serial.h" #include "io/serial.h"
#include "io/gps.h" #include "io/gps.h"
@ -172,6 +173,8 @@ int32_t mAhDrawn;
uint32_t fixedMillis = 0; uint32_t fixedMillis = 0;
baro_t baro;
uint32_t millis(void) { uint32_t millis(void) {
return fixedMillis; return fixedMillis;
} }