mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
ignore fixes that have NaN as the speed
Change-Id: Ibfca37e6b0d0e3b59c992db3a318ecea3e4decd5
This commit is contained in:
+24
-20
@@ -119,29 +119,33 @@ public class NMEAWindReceiverImpl implements NMEAWindReceiver {
|
||||
final Speed speed;
|
||||
if (!Double.isNaN(sentence.getWindSpeed())) {
|
||||
speed = new MeterPerSecondSpeedImpl(sentence.getWindSpeed());
|
||||
} else {
|
||||
} else if (!Double.isNaN(sentence.getWindSpeedKnots())) {
|
||||
speed = new KnotSpeedImpl(sentence.getWindSpeedKnots());
|
||||
}
|
||||
final Bearing direction;
|
||||
if (!Double.isNaN(sentence.getTrueWindDirection())) {
|
||||
direction = new DegreeBearingImpl(sentence.getTrueWindDirection());
|
||||
} else {
|
||||
Declination declination;
|
||||
try {
|
||||
declination = declinationService.getDeclination(timePoint, position, /* timeoutForOnlineFetchInMilliseconds */ 1000);
|
||||
if (declination != null) {
|
||||
direction = new DegreeBearingImpl(sentence.getMagneticWindDirection()).add(declination.getBearingCorrectedTo(timePoint));
|
||||
} else {
|
||||
direction = null;
|
||||
speed = null;
|
||||
}
|
||||
if (speed != null) {
|
||||
final Bearing direction;
|
||||
if (!Double.isNaN(sentence.getTrueWindDirection())) {
|
||||
direction = new DegreeBearingImpl(sentence.getTrueWindDirection());
|
||||
} else {
|
||||
Declination declination;
|
||||
try {
|
||||
declination = declinationService.getDeclination(timePoint, position, /* timeoutForOnlineFetchInMilliseconds */ 1000);
|
||||
if (declination != null) {
|
||||
direction = new DegreeBearingImpl(sentence.getMagneticWindDirection()).add(declination.getBearingCorrectedTo(timePoint));
|
||||
} else {
|
||||
direction = null;
|
||||
}
|
||||
if (direction != null) {
|
||||
final KnotSpeedWithBearingAndTimepoint fix = new KnotSpeedWithBearingAndTimepoint(timePoint,
|
||||
speed.getKnots(), direction);
|
||||
trueWind.add(fix);
|
||||
tryToCreateWindFixFromTrueWind(fix);
|
||||
}
|
||||
} catch (ParseException | IOException e) {
|
||||
logger.log(Level.WARNING, "Couldn't correct magnetic TWD reading by declination; ignoring", e);
|
||||
}
|
||||
if (direction != null) {
|
||||
final KnotSpeedWithBearingAndTimepoint fix = new KnotSpeedWithBearingAndTimepoint(timePoint,
|
||||
speed.getKnots(), direction);
|
||||
trueWind.add(fix);
|
||||
tryToCreateWindFixFromTrueWind(fix);
|
||||
}
|
||||
} catch (ParseException | IOException e) {
|
||||
logger.log(Level.WARNING, "Couldn't correct magnetic TWD reading by declination; ignoring", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user