mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 20:38:27 +08:00
[modules][messages] add AMSL message to air_data
This commit is contained in:
+5
-1
@@ -1954,7 +1954,11 @@
|
||||
<field name="tas_factor" type="float"/>
|
||||
</message>
|
||||
|
||||
<!--223 is free -->
|
||||
<message name="AMSL" id="223">
|
||||
<field name="AMSL_BARO" type="float" unit="ft" alt_unit="m"/>
|
||||
<field name="AMSL_GPS" type="float" unit="ft" alt_unit="m"/>
|
||||
</message>
|
||||
|
||||
<!--224 is free -->
|
||||
|
||||
<message name="VIDEO_SYNC" id="225">
|
||||
|
||||
@@ -152,6 +152,14 @@ static void send_air_data(void)
|
||||
&air_data.amsl_baro, &air_data.airspeed,
|
||||
&air_data.tas_factor);
|
||||
}
|
||||
|
||||
static void send_amsl(void)
|
||||
{
|
||||
const float MeterPerFeet = 0.3048;
|
||||
float amsl_baro_ft = air_data.amsl_baro / MeterPerFeet;
|
||||
float amsl_gps_ft = stateGetPositionLla_f()->alt / MeterPerFeet;
|
||||
DOWNLINK_SEND_AMSL(DefaultChannel, DefaultDevice, &amsl_baro_ft, &amsl_gps_ft);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** AirData initialization. Called at startup.
|
||||
@@ -191,6 +199,7 @@ void air_data_init(void)
|
||||
#if PERIODIC_TELEMETRY
|
||||
register_periodic_telemetry(DefaultPeriodic, "BARO_RAW", send_baro_raw);
|
||||
register_periodic_telemetry(DefaultPeriodic, "AIR_DATA", send_air_data);
|
||||
register_periodic_telemetry(DefaultPeriodic, "AMSL", send_amsl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user