Skip to content

Commit f602e04

Browse files
committed
LP-608 Add Airspeed data to General and Electric Air module message
1 parent d6ef3b7 commit f602e04

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

flight/modules/UAVOHottBridge/inc/uavohottbridge.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ struct telemetrydata {
176176
FlightBatteryStateData Battery;
177177
FlightStatusData FlightStatus;
178178
GPSPositionSensorData GPS;
179-
GPSTimeData GPStime;
179+
AirspeedStateData Airspeed;
180+
GPSTimeData GPStime;
180181
GyroSensorData Gyro;
181182
HomeLocationData Home;
182183
PositionStateData Position;

flight/modules/UAVOHottBridge/uavohottbridge.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "gyrosensor.h"
4646
#include "gpspositionsensor.h"
4747
#include "gpstime.h"
48+
#include "airspeedstate.h"
4849
#include "homelocation.h"
4950
#include "positionstate.h"
5051
#include "systemalarms.h"
@@ -451,6 +452,10 @@ uint16_t build_GAM_message(struct hott_gam_message *msg)
451452
msg->current = scale_float2uword(current, 10, 0);
452453
msg->capacity = scale_float2uword(energy, 0.1f, 0);
453454

455+
// AirSpeed
456+
float airspeed = (telestate->Airspeed.TrueAirspeed > 0) ? telestate->Airspeed.TrueAirspeed : 0;
457+
msg->speed = scale_float2uword(airspeed, MS_TO_KMH, 0);
458+
454459
// pressure kPa to 0.1Bar
455460
msg->pressure = scale_float2uint8(telestate->Baro.Pressure, 0.1f, 0);
456461

@@ -496,6 +501,10 @@ uint16_t build_EAM_message(struct hott_eam_message *msg)
496501
msg->current = scale_float2uword(current, 10, 0);
497502
msg->capacity = scale_float2uword(energy, 0.1f, 0);
498503

504+
// AirSpeed
505+
float airspeed = (telestate->Airspeed.TrueAirspeed > 0) ? telestate->Airspeed.TrueAirspeed : 0;
506+
msg->speed = scale_float2uword(airspeed, MS_TO_KMH, 0);
507+
499508
// temperatures
500509
msg->temperature1 = scale_float2uint8(telestate->Gyro.temperature, 1, OFFSET_TEMPERATURE);
501510
msg->temperature2 = scale_float2uint8(telestate->Baro.Temperature, 1, OFFSET_TEMPERATURE);
@@ -597,6 +606,9 @@ void update_telemetrydata()
597606
if (GPSPositionSensorHandle() != NULL) {
598607
GPSPositionSensorGet(&telestate->GPS);
599608
}
609+
if (AirspeedStateHandle() != NULL) {
610+
AirspeedStateGet(&telestate->Airspeed);
611+
}
600612
if (GPSTimeHandle() != NULL) {
601613
GPSTimeGet(&telestate->GPStime);
602614
}

0 commit comments

Comments
 (0)