made another correction regarding the MWC sentence when T (theoretical) is provided

Change-Id: I8d4f2eb0176b8f17f18f45f03b04a3be78e81a13
This commit is contained in:
Axel Uhl
2017-08-07 14:46:52 +02:00
parent dd38eb2fa0
commit 5ea1d70bcf
@@ -91,12 +91,20 @@ public class NMEAWindReceiverImpl implements NMEAWindReceiver {
if (timePoint != null) {
try {
final Speed speed = createSpeed(sentence.getSpeedUnit(), sentence.getSpeed());
final KnotSpeedWithBearingAndTimepoint fix = new KnotSpeedWithBearingAndTimepoint(timePoint,
speed.getKnots(), new DegreeBearingImpl(sentence.getAngle()).reverse());
final KnotSpeedWithBearingAndTimepoint fix;
if (sentence.isTrue()) {
trueWind.add(fix);
tryToCreateWindFixFromTrueWind(fix);
final Bearing trueHeading = trueHeadings.getInterpolatedValue(getLastTimePoint(), f->new ScalableBearing(f));
if (trueHeading != null) {
// need to take heading into account as MWV is still relative to bow, even if "true" is provided;
// it is what you would see on the wind display when set to "true wind"
fix = new KnotSpeedWithBearingAndTimepoint(timePoint,
speed.getKnots(), new DegreeBearingImpl(sentence.getAngle()).reverse().add(trueHeading));
trueWind.add(fix);
tryToCreateWindFixFromTrueWind(fix);
}
} else {
fix = new KnotSpeedWithBearingAndTimepoint(timePoint,
speed.getKnots(), new DegreeBearingImpl(sentence.getAngle()).reverse());
apparentWind.add(fix);
tryToCreateWindFixFromApparentWind(fix);
}