Replay: cope with bad NSats field from old logs

This commit is contained in:
Andrew Tridgell 2015-07-02 16:49:37 +10:00
parent af8b9e703c
commit 4f9ccf727a
2 changed files with 7 additions and 2 deletions

View File

@ -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)) {
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,
(AP_GPS::GPS_Status)status,
uint32_t(time_us/1000),
loc,
vel,
require_field_uint8_t(msg, "NSats"),
nsats,
hdop,
require_field_float(msg, "VZ") != 0);
if (status == AP_GPS::GPS_OK_FIX_3D && ground_alt_cm == 0) {

View File

@ -67,7 +67,6 @@ private:
void init_field_types();
void add_field_type(char type, size_t size);
uint8_t size_for_type(char type);
void field_not_found(uint8_t *msg, const char *label);
protected:
struct log_Format f; // the format we are a parser for
@ -87,6 +86,7 @@ protected:
const char *label_roll,
const char *label_pitch,
const char *label_yaw);
void field_not_found(uint8_t *msg, const char *label);
};
template<typename R>