Improve satellite view and fused location telemetry
This commit is contained in:
@@ -103,6 +103,26 @@ std::optional<ParsedTelemetry> LocationParser::parseLine(const QString &line)
|
||||
telemetry.source = LocationSource::Gps;
|
||||
}
|
||||
}
|
||||
static const QRegularExpression fusionModeRegex(
|
||||
QStringLiteral(R"((?:^|\s)mode\s*=\s*(?<mode>gps[_-]?aided|dead[_-]?reckoning)(?=$|\s))"),
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpressionMatch fusionModeMatch = fusionModeRegex.match(trimmed);
|
||||
if (fusionModeMatch.hasMatch()) {
|
||||
telemetry.fusionMode = fusionModeMatch.captured(QStringLiteral("mode")).startsWith(
|
||||
QStringLiteral("dead"), Qt::CaseInsensitive)
|
||||
? FusionMode::DeadReckoning : FusionMode::GpsAided;
|
||||
}
|
||||
static const QRegularExpression gpsAgeRegex(
|
||||
QStringLiteral(R"((?:^|\s)gps[_-]?age[_-]?ms\s*=\s*(?<age>\d+)(?=$|\s))"),
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
const QRegularExpressionMatch gpsAgeMatch = gpsAgeRegex.match(trimmed);
|
||||
if (gpsAgeMatch.hasMatch()) {
|
||||
bool ok = false;
|
||||
const qint64 ageMs = gpsAgeMatch.captured(QStringLiteral("age")).toLongLong(&ok);
|
||||
if (ok) {
|
||||
telemetry.gpsAgeMs = ageMs;
|
||||
}
|
||||
}
|
||||
bool hadCoordinateField = false;
|
||||
bool hadLatitudeField = false;
|
||||
bool hadLongitudeField = false;
|
||||
|
||||
Reference in New Issue
Block a user