Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SignalK/signalk-derived-data
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.32.0
Choose a base ref
...
head repository: SignalK/signalk-derived-data
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jan 4, 2024

  1. Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    47144c4 View commit details
  2. chore: remove old release tooling

    tkurki committed Jan 4, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    6b2ba66 View commit details
  3. 1.32.1

    tkurki committed Jan 4, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    8a90bb9 View commit details

Commits on Mar 2, 2024

  1. Fix issue where the roll is using the wrong path (#129)

    Fix issue where calculated leeway is invalid if STW is 0
    rogerlittin authored Mar 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7c2b125 View commit details
  2. 1.32.2

    tkurki committed Mar 2, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    89d148d View commit details

Commits on Apr 19, 2024

  1. fix(moon): change to type specific return values (#123)

    godind authored Apr 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9c129d3 View commit details
  2. 1.33.0

    tkurki committed Apr 19, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    7fdb36c View commit details

Commits on Jul 12, 2024

  1. Calculate propulsion..state based on propulsion..revolutions (#118)

    macjl authored Jul 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    85762e8 View commit details
  2. estimatedTimeOfArrival, timeToGo and eta are calculated incorrectly i…

    …n eta.js - Issue #133 (#134)
    
    the calculation uses:
    distance / (velocityMadeGood * 0.514444) * 1000
    
    this assumes that VMG is in kts when it is (and should be) in m/s.
    
    The 0.514444 should be removed from the calc on line 22
    Techstyleuk authored Jul 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f49d09f View commit details
  3. chore: add test for eta calculations

    tkurki committed Jul 12, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    01317ae View commit details
  4. add distanceToSelf output option to "Traffic" section (#115)

    humppafreak authored Jul 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    680efd2 View commit details
  5. 1.34.0

    tkurki committed Jul 12, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    dbe9cfd View commit details

Commits on Jul 27, 2024

  1. fix: In trueWind.js derived values are now set to null in case that t…

    …he input is null.
    
    In trueWind.js derived values are now set to null in case that the input is null. Before a AWS of null resulted in a TWS of 0.
    chris0348 authored and tkurki committed Jul 27, 2024
    Copy the full SHA
    85110da View commit details
  2. 1.34.1

    tkurki committed Jul 27, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    ffb40e4 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    e9db89b View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    e23af92 View commit details
  5. Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    563a083 View commit details
  6. Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    1ff3e04 View commit details
  7. fix: null handling in windDirectionMagnetic.js

    tkurki committed Jul 27, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    5c5f05d View commit details

Commits on Aug 10, 2024

  1. Merge pull request #139 from SignalK/null-magneticvariation

    Fix: handling of null magneticVariation
    tkurki authored Aug 10, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3ad42f1 View commit details
  2. 1.34.2

    tkurki committed Aug 10, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    fdb4ddd View commit details

Commits on Sep 1, 2024

  1. Add capacity to tankVolume.js (#132)

    Add capacity calculation in addition to volume
    macjl authored Sep 1, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    346639c View commit details
  2. 1.35.0

    tkurki committed Sep 1, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    tkurki Teppo Kurki
    Copy the full SHA
    9a2cfe0 View commit details
27 changes: 27 additions & 0 deletions .github/workflows/release_on_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Release on tag'
on:
push:
tags:
- '*'

jobs:
release:
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}

- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{steps.github_release.outputs.changelog}}
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
13 changes: 13 additions & 0 deletions .github/workflows/require_pr_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull Request Labels
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v1
with:
mode: exactly
count: 1
labels: "fix, feature, doc, chore, test, ignore, other, dependencies"
9 changes: 6 additions & 3 deletions calcs/courseOverGroundMagnetic.js
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@ module.exports = function (app, plugin) {
magneticVariation = app.getSelfPath(
'navigation.magneticVariation.value'
)
if (_.isUndefined(magneticVariation)) {
return
}
}
if (_.isUndefined(magneticVariation) || magneticVariation === null) {
return
}
if (
_.isUndefined(courseOverGroundTrue) ||
@@ -46,6 +46,9 @@ module.exports = function (app, plugin) {
{
input: [null, -0.01],
expected: [{ path: 'navigation.courseOverGroundMagnetic', value: null }]
},
{
input: [0.2, null]
}
]
}
9 changes: 6 additions & 3 deletions calcs/courseOverGroundTrue.js
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@ module.exports = function (app, plugin) {
magneticVariation = app.getSelfPath(
'navigation.magneticVariation.value'
)
if (_.isUndefined(magneticVariation)) {
return
}
}
if (_.isUndefined(magneticVariation) || magneticVariation === null) {
return
}
if (
_.isUndefined(courseOverGroundMagnetic) ||
@@ -39,6 +39,9 @@ module.exports = function (app, plugin) {
{
input: [null, 0.01],
expected: [{ path: 'navigation.courseOverGroundTrue', value: null }]
},
{
input: [0.2, null]
}
]
}
26 changes: 26 additions & 0 deletions calcs/cpa_tcpa.js
Original file line number Diff line number Diff line change
@@ -23,6 +23,12 @@ module.exports = function (app, plugin) {
'Calculate for all vessels within this range (m), negative to disable filter',
default: 1852
},
distanceToSelf: {
type: 'boolean',
title:
'Calculate distance to self for all vessels',
default: true
},
timelimit: {
type: 'number',
title:
@@ -121,6 +127,26 @@ module.exports = function (app, plugin) {
},
{ latitude: vesselPos.latitude, longitude: vesselPos.longitude }
)

if (
plugin.properties.traffic.distanceToSelf
) {
app.debug('distance of ' + vessel + ' to self: ' + distance)
app.handleMessage(plugin.id, {
context: 'vessels.' + vessel,
updates: [
{
values: [
{
path: 'navigation.distanceToSelf',
value: distance
}
]
}
]
})
}

if (
distance >= plugin.properties.traffic.range &&
plugin.properties.traffic.range >= 0
26 changes: 22 additions & 4 deletions calcs/eta.js
Original file line number Diff line number Diff line change
@@ -18,9 +18,7 @@ module.exports = function (app) {
}

var datems = date.getTime()
var timetopoint = Math.floor(
distance / (velocityMadeGood * 0.514444) * 1000
)
var timetopoint = Math.floor(distance / velocityMadeGood * 1000)

// app.debug(`Using datetime: ${date} ms to point : ${timetopoint} currentms: ${datems}`)
var etams = datems + timetopoint
@@ -50,6 +48,26 @@ module.exports = function (app) {
value: eta
}
]
}
},
tests: [
{
input: ['2024-07-12T18:00:00Z', 1000, 2],
expected: [
{
path:
'navigation.courseGreatCircle.nextPoint.estimatedTimeOfArrival',
value: '2024-07-12T18:08:20.000Z'
},
{
path: 'navigation.courseGreatCircle.nextPoint.timeToGo',
value: 500
},
{
path: 'navigation.courseGreatCircle.nextPoint.eta',
value: '2024-07-12T18:08:20.000Z'
}
]
}
]
}
}
9 changes: 6 additions & 3 deletions calcs/headingTrue.js
Original file line number Diff line number Diff line change
@@ -12,9 +12,9 @@ module.exports = function (app, plugin) {
magneticVariation = app.getSelfPath(
'navigation.magneticVariation.value'
)
if (_.isUndefined(magneticVariation)) {
return
}
}
if (_.isUndefined(magneticVariation) || magneticVariation === null) {
return
}
if (_.isUndefined(heading) || heading === null) {
return [{ path: 'navigation.headingTrue', value: null }]
@@ -31,6 +31,9 @@ module.exports = function (app, plugin) {
{
input: [null, 0.01],
expected: [{ path: 'navigation.headingTrue', value: null }]
},
{
input: [0.2, null]
}
]
}
9 changes: 4 additions & 5 deletions calcs/leeway.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ module.exports = function (app, plugin) {
group: 'heading',
optionKey: 'leeway',
title: 'Leeway',
derivedFrom: ['navigation.attitude.roll', 'navigation.speedThroughWater'],
derivedFrom: ['navigation.attitude', 'navigation.speedThroughWater'],
properties: {
kFactor: {
type: 'number',
@@ -13,12 +13,11 @@ module.exports = function (app, plugin) {
default: 12
}
},
calculator: function (roll, stw) {
calculator: function (attitude, stw) {
var kFactor = plugin.properties.heading.kFactor
var rollDegrees = roll / Math.PI * 360
var rollDegrees = attitude.roll / Math.PI * 360
var stwKnots = stw * 1.94384
var leewayAngle =
kFactor * rollDegrees / Math.pow(stwKnots, 2) / 360 * Math.PI
var leewayAngle = stwKnots <= 0 ? 0 : kFactor * rollDegrees / Math.pow(stwKnots, 2) / 360 * Math.PI
// app.debug('roll: ' + rollDegrees + ' stw: ' + stwKnots + ' knots => leeway: ' + leewayAngle/Math.PI*360)
return [{ path: 'performance.leeway', value: leewayAngle }]
}
21 changes: 11 additions & 10 deletions calcs/moon.js
Original file line number Diff line number Diff line change
@@ -7,24 +7,22 @@ module.exports = function (app, plugin) {
optionKey: 'Moon',
title: 'Sets environment.moon.* information such as phase, rise, and set',
derivedFrom: ['navigation.datetime', 'navigation.position'],
defaults: ['', undefined],
defaults: [undefined, undefined],
debounceDelay: 60 * 1000,
calculator: function (datetime, position) {
var value
var mode
var date

if (datetime && datetime.length > 0) {
if (!_.isUndefined(datetime) && datetime.length > 0) {
date = new Date(datetime)
} else {
date = new Date()
}

app.debug(`Using datetime: ${date} position: ${JSON.stringify(position)}`)

var illumination = suncalc.getMoonIllumination(date)
const illumination = suncalc.getMoonIllumination(date)
_.keys(illumination).forEach(key => {
illumination[key] = illumination[key].toFixed(2)
illumination[key] = _.round(illumination[key], 2)
})
app.debug('moon illumination:' + JSON.stringify(illumination, null, 2))

@@ -57,27 +55,30 @@ module.exports = function (app, plugin) {
}
app.debug('Phase Name:' + phaseName)

var times = suncalc.getMoonTimes(
const times = suncalc.getMoonTimes(
date,
position.latitude,
position.longitude
)
app.debug('moon times:' + JSON.stringify(times, null, 2))

return [
{ path: 'environment.moon.fraction', value: illumination.fraction },
{
path: 'environment.moon.fraction',
value: illumination.fraction
},
{ path: 'environment.moon.phase', value: illumination.phase },
{ path: 'environment.moon.phaseName', value: phaseName },
{ path: 'environment.moon.angle', value: illumination.angle },
{ path: 'environment.moon.times.rise', value: times.rise || null },
{ path: 'environment.moon.times.set', value: times.set || null },
{
path: 'environment.moon.times.alwaysUp',
value: times.alwaysUp ? 'true' : 'false'
value: !!times.alwaysUp
},
{
path: 'environment.moon.times.alwaysDown',
value: times.alwaysDown ? 'true' : 'false'
value: !!times.alwaysDown
}
]
}
40 changes: 40 additions & 0 deletions calcs/propState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const _ = require('lodash')

module.exports = function (app, plugin) {
var engines = plugin.engines

app.debug('engines: %j', engines)

return engines.map(instance => {
return {
group: 'propulsion',
optionKey: instance + 'state',
title: `${instance} propulsion state (based on revolutions)`,
derivedFrom: function () {
return [
'propulsion.' + instance + '.revolutions'
]
},
calculator: function (revol) {
const currentState =
app.getSelfPath('propulsion.' + instance + '.state.value') || 'none'

if ((revol > 0) && (currentState !== "started")) {
return [
{
path: 'propulsion.' + instance + '.state',
value: "started"
}
]
} else if ((revol == 0) && (currentState !== "stopped")) {
return [
{
path: 'propulsion.' + instance + '.state',
value: "stopped"
}
]
}
}
}
})
}
20 changes: 18 additions & 2 deletions calcs/setDrift.js
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ module.exports = function (app, plugin) {
}

var setTrue = setMagnetic + magneticVariation
if (_.isUndefined(magneticVariation)) {
if (_.isUndefined(magneticVariation) || magneticVariation === null) {
setTrue = null
} else if (setTrue >= 2 * Math.Pi) {
setTrue = setTrue - Math.PI * 2
@@ -65,6 +65,22 @@ module.exports = function (app, plugin) {
{ path: 'environment.current.setTrue', value: setTrue },
{ path: 'environment.current.setMagnetic', value: setMagnetic }
]
}
},
tests: [
{
input: [0.1, 0.2, 5, 4.5, null],
expected: [
{ path: 'environment.current.drift', value: 0.6890664427243886 },
{
path: 'environment.current.setTrue',
value: null
},
{
path: 'environment.current.setMagnetic',
value: 3.0482899952302343
}
]
}
]
}
}
6 changes: 5 additions & 1 deletion calcs/tankVolume.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ module.exports = function (app, plugin) {
title:
"'tanks." +
instance +
"' Tank Volume (requires calibration pairs (>2 for parallell sides, >3 for straight wedge and >4 for more complex shapes)",
"' Tank Volume and Capacity (requires calibration pairs (>2 for parallell sides, >3 for straight wedge and >4 for more complex shapes)",
derivedFrom: function () {
return ['tanks.' + instance + '.currentLevel']
},
@@ -64,6 +64,10 @@ module.exports = function (app, plugin) {
})

return [
{
path: 'tanks.' + instance + '.capacity',
value: spline(1, calLevels, calVolumes)
},
{
path: 'tanks.' + instance + '.currentVolume',
value: spline(level, calLevels, calVolumes)
Loading