mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-09 17:38:32 -04:00
DataFlash: convert to new GPS API
This commit is contained in:
parent
368daf89f1
commit
31d3b6555f
@ -48,8 +48,7 @@ public:
|
|||||||
void EnableWrites(bool enable) { _writes_enabled = enable; }
|
void EnableWrites(bool enable) { _writes_enabled = enable; }
|
||||||
void Log_Write_Format(const struct LogStructure *structure);
|
void Log_Write_Format(const struct LogStructure *structure);
|
||||||
void Log_Write_Parameter(const char *name, float value);
|
void Log_Write_Parameter(const char *name, float value);
|
||||||
void Log_Write_GPS(const GPS *gps, int32_t relative_alt);
|
void Log_Write_GPS(const AP_GPS &gps, int32_t relative_alt);
|
||||||
void Log_Write_GPS2(const GPS *gps);
|
|
||||||
void Log_Write_IMU(const AP_InertialSensor &ins);
|
void Log_Write_IMU(const AP_InertialSensor &ins);
|
||||||
void Log_Write_RCIN(void);
|
void Log_Write_RCIN(void);
|
||||||
void Log_Write_RCOUT(void);
|
void Log_Write_RCOUT(void);
|
||||||
|
@ -662,48 +662,49 @@ void DataFlash_Class::Log_Write_Parameters(void)
|
|||||||
|
|
||||||
|
|
||||||
// Write an GPS packet
|
// Write an GPS packet
|
||||||
void DataFlash_Class::Log_Write_GPS(const GPS *gps, int32_t relative_alt)
|
void DataFlash_Class::Log_Write_GPS(const AP_GPS &gps, int32_t relative_alt)
|
||||||
{
|
{
|
||||||
|
const struct Location &loc = gps.location(0);
|
||||||
struct log_GPS pkt = {
|
struct log_GPS pkt = {
|
||||||
LOG_PACKET_HEADER_INIT(LOG_GPS_MSG),
|
LOG_PACKET_HEADER_INIT(LOG_GPS_MSG),
|
||||||
status : (uint8_t)gps->status(),
|
status : (uint8_t)gps.status(0),
|
||||||
gps_week_ms : gps->time_week_ms,
|
gps_week_ms : gps.time_week_ms(0),
|
||||||
gps_week : gps->time_week,
|
gps_week : gps.time_week(0),
|
||||||
num_sats : gps->num_sats,
|
num_sats : gps.num_sats(0),
|
||||||
hdop : gps->hdop,
|
hdop : gps.get_hdop(0),
|
||||||
latitude : gps->latitude,
|
latitude : loc.lat,
|
||||||
longitude : gps->longitude,
|
longitude : loc.lng,
|
||||||
rel_altitude : relative_alt,
|
rel_altitude : relative_alt,
|
||||||
altitude : gps->altitude_cm,
|
altitude : loc.alt,
|
||||||
ground_speed : gps->ground_speed_cm,
|
ground_speed : (uint32_t)(gps.ground_speed(0) * 100),
|
||||||
ground_course : gps->ground_course_cd,
|
ground_course : gps.ground_course_cd(0),
|
||||||
vel_z : gps->velocity_down(),
|
vel_z : gps.velocity(0).z,
|
||||||
apm_time : hal.scheduler->millis()
|
apm_time : hal.scheduler->millis()
|
||||||
};
|
};
|
||||||
WriteBlock(&pkt, sizeof(pkt));
|
WriteBlock(&pkt, sizeof(pkt));
|
||||||
}
|
#if HAL_CPU_CLASS > HAL_CPU_CLASS_16
|
||||||
|
if (gps.num_sensors() > 1) {
|
||||||
// Write a GPS2 packet
|
const struct Location &loc2 = gps.location(1);
|
||||||
void DataFlash_Class::Log_Write_GPS2(const GPS *gps)
|
struct log_GPS2 pkt2 = {
|
||||||
{
|
LOG_PACKET_HEADER_INIT(LOG_GPS2_MSG),
|
||||||
struct log_GPS2 pkt = {
|
status : (uint8_t)gps.status(1),
|
||||||
LOG_PACKET_HEADER_INIT(LOG_GPS2_MSG),
|
gps_week_ms : gps.time_week_ms(1),
|
||||||
status : (uint8_t)gps->status(),
|
gps_week : gps.time_week(1),
|
||||||
gps_week_ms : gps->time_week_ms,
|
num_sats : gps.num_sats(1),
|
||||||
gps_week : gps->time_week,
|
hdop : gps.get_hdop(1),
|
||||||
num_sats : gps->num_sats,
|
latitude : loc2.lat,
|
||||||
hdop : gps->hdop,
|
longitude : loc2.lng,
|
||||||
latitude : gps->latitude,
|
altitude : loc2.alt,
|
||||||
longitude : gps->longitude,
|
ground_speed : (uint32_t)(gps.ground_speed(1)*100),
|
||||||
altitude : gps->altitude_cm,
|
ground_course : gps.ground_course_cd(1),
|
||||||
ground_speed : gps->ground_speed_cm,
|
vel_z : gps.velocity(1).z,
|
||||||
ground_course : gps->ground_course_cd,
|
apm_time : hal.scheduler->millis(),
|
||||||
vel_z : gps->velocity_down(),
|
dgps_numch : 0,
|
||||||
apm_time : hal.scheduler->millis(),
|
dgps_age : 0
|
||||||
dgps_numch : 0,
|
};
|
||||||
dgps_age : 0
|
WriteBlock(&pkt2, sizeof(pkt2));
|
||||||
};
|
}
|
||||||
WriteBlock(&pkt, sizeof(pkt));
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write an RCIN packet
|
// Write an RCIN packet
|
||||||
|
Loading…
Reference in New Issue
Block a user