mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-24 05:45:59 +08:00
update generic_com module to new gps interface
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
#include "estimator.h"
|
||||
#include "gps.h"
|
||||
#include "subsystems/gps.h"
|
||||
#include "subsystems/electrical.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "inter_mcu.h"
|
||||
@@ -71,11 +71,11 @@ void generic_com_periodic( void ) {
|
||||
if (com_trans.status != I2CTransDone) { return; }
|
||||
|
||||
com_trans.buf[0] = active_com;
|
||||
FillBufWith32bit(com_trans.buf, 1, gps_lat);
|
||||
FillBufWith32bit(com_trans.buf, 5, gps_lon);
|
||||
FillBufWith16bit(com_trans.buf, 9, (int16_t)(gps_alt/100)); // meters
|
||||
FillBufWith16bit(com_trans.buf, 11, gps_gspeed); // ground speed
|
||||
FillBufWith16bit(com_trans.buf, 13, gps_course); // course
|
||||
FillBufWith32bit(com_trans.buf, 1, gps.lla_pos.lat);
|
||||
FillBufWith32bit(com_trans.buf, 5, gps.lla_pos.lon);
|
||||
FillBufWith16bit(com_trans.buf, 9, (int16_t)(gps.lla_pos.alt/1000)); // altitude (meters)
|
||||
FillBufWith16bit(com_trans.buf, 11, gps.gspeed); // ground speed (cm/s)
|
||||
FillBufWith16bit(com_trans.buf, 13, (int16_t)(gps.course/1e4)); // course (1e3rad)
|
||||
FillBufWith16bit(com_trans.buf, 15, (uint16_t)(estimator_airspeed*100)); // TAS (cm/s)
|
||||
com_trans.buf[17] = electrical.vsupply; // decivolts
|
||||
com_trans.buf[18] = (uint8_t)(energy/100); // deciAh
|
||||
|
||||
@@ -282,11 +282,11 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
|
||||
a.flight_time <- flight_time;
|
||||
let lat = fvalue "lat"
|
||||
and lon = fvalue "lon" in
|
||||
let geo = make_geo_deg (lat /. 1e7) (lon /. 1e7) in
|
||||
let geo = make_geo (lat /. 1e7) (lon /. 1e7) in
|
||||
a.pos <- geo;
|
||||
a.alt <- fvalue "alt";
|
||||
a.gspeed <- fvalue "gspeed" /. 100.;
|
||||
a.course <- norm_course ((Deg>>Rad)(fvalue "course" /. 10.));
|
||||
a.course <- norm_course (fvalue "course" /. 1e3);
|
||||
if !heading_from_course then
|
||||
a.heading <- a.course;
|
||||
a.agl <- a.alt -. float (try Srtm.of_wgs84 a.pos with _ -> 0);
|
||||
|
||||
@@ -55,6 +55,7 @@ unsigned char* md5 = (unsigned char*)MD5SUM;
|
||||
#define MAX_PPRZ 9600
|
||||
|
||||
#define RadOfDeg(x) ((x) * (M_PI/180.))
|
||||
#define DegOfRad(x) ((x) * (180./M_PI))
|
||||
|
||||
static const char usage_str[] =
|
||||
"tcp2ivy [options]\n"
|
||||
@@ -151,8 +152,8 @@ static gboolean read_data(GIOChannel *chan, GIOCondition cond, gpointer data) {
|
||||
#endif
|
||||
|
||||
printf("**** message received from iridium module ****\n");
|
||||
printf("gps_lat %f\n", gps_lat/1e7);
|
||||
printf("gps_lon %f\n", gps_lon/1e7);
|
||||
printf("gps_lat %f\n", DegOfRad(gps_lat/1e7));
|
||||
printf("gps_lon %f\n", DegOfRad(gps_lon/1e7));
|
||||
printf("gps_alt %d\n", gps_alt);
|
||||
printf("gps_gspeed %d\n", gps_gspeed);
|
||||
printf("gps_course %d\n", gps_course);
|
||||
|
||||
Reference in New Issue
Block a user