mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Replay: cope with bad NSats field from old logs
This commit is contained in:
parent
af8b9e703c
commit
4f9ccf727a
@ -154,12 +154,17 @@ void LR_MsgHandler_GPS_Base::update_from_msg_gps(uint8_t gps_offset, uint8_t *ms
|
|||||||
! field_value(msg, "HDp", hdop)) {
|
! field_value(msg, "HDp", hdop)) {
|
||||||
hdop = 20;
|
hdop = 20;
|
||||||
}
|
}
|
||||||
|
uint8_t nsats = 0;
|
||||||
|
if (! field_value(msg, "NSats", nsats) &&
|
||||||
|
! field_value(msg, "numSV", nsats)) {
|
||||||
|
field_not_found(msg, "NSats");
|
||||||
|
}
|
||||||
gps.setHIL(gps_offset,
|
gps.setHIL(gps_offset,
|
||||||
(AP_GPS::GPS_Status)status,
|
(AP_GPS::GPS_Status)status,
|
||||||
uint32_t(time_us/1000),
|
uint32_t(time_us/1000),
|
||||||
loc,
|
loc,
|
||||||
vel,
|
vel,
|
||||||
require_field_uint8_t(msg, "NSats"),
|
nsats,
|
||||||
hdop,
|
hdop,
|
||||||
require_field_float(msg, "VZ") != 0);
|
require_field_float(msg, "VZ") != 0);
|
||||||
if (status == AP_GPS::GPS_OK_FIX_3D && ground_alt_cm == 0) {
|
if (status == AP_GPS::GPS_OK_FIX_3D && ground_alt_cm == 0) {
|
||||||
|
@ -67,7 +67,6 @@ private:
|
|||||||
void init_field_types();
|
void init_field_types();
|
||||||
void add_field_type(char type, size_t size);
|
void add_field_type(char type, size_t size);
|
||||||
uint8_t size_for_type(char type);
|
uint8_t size_for_type(char type);
|
||||||
void field_not_found(uint8_t *msg, const char *label);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct log_Format f; // the format we are a parser for
|
struct log_Format f; // the format we are a parser for
|
||||||
@ -87,6 +86,7 @@ protected:
|
|||||||
const char *label_roll,
|
const char *label_roll,
|
||||||
const char *label_pitch,
|
const char *label_pitch,
|
||||||
const char *label_yaw);
|
const char *label_yaw);
|
||||||
|
void field_not_found(uint8_t *msg, const char *label);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename R>
|
template<typename R>
|
||||||
|
Loading…
Reference in New Issue
Block a user