Skip to content

Commit

Permalink
VHW SignalK#2
Browse files Browse the repository at this point in the history
  • Loading branch information
fsaux committed Jan 28, 2023
1 parent 8695a0a commit c0d74cf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sentences/VHW.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ module.exports = function (app) {
'navigation.speedThroughWater'
],
f: function vhw (headingTrue, magneticVariation, speedThroughWater) {
var headingMagnetic = headingTrue + magneticVariation
if (headingMagnetic > Math.PI * 2) {
headingMagnetic -= Math.PI * 2
}
if (headingMagnetic < 0) {
headingMagnetic += Math.PI * 2
if (headingTrue !== null && magneticVariation !== null) {
var headingMagnetic = headingTrue + magneticVariation
if (headingMagnetic > Math.PI * 2) {
headingMagnetic -= Math.PI * 2
}
if (headingMagnetic < 0) {
headingMagnetic += Math.PI * 2
}
}
return nmea.toSentence([
'$IIVHW',
Expand Down

0 comments on commit c0d74cf

Please sign in to comment.