SignalK / signalk-derived-data

Generates deltas for values derived from signalk values
Apache License 2.0
18 stars 31 forks source link

Derived data plugin doesn't always generate paths if the source data came from another plugin #49

Closed fabdrol closed 4 years ago

fabdrol commented 4 years ago

Situation I have a plugin which generates SK paths. I use this to "inject" certain data into my SK setup (such as the distance between the keel and the depth transducer). I have set up signalk-derived-data to generate depth.belowKeel.

Expected behaviour I expect to see depth values on the path depth.belowKeel.

Actual behaviour depth.belowKeel is never generated

Notes If I restart (untick and tick active) signalk-derived-data, the plugin starts generating data for depth.belowKeel. The issue thus only occurs if both plugins are started during the startup procedure of Node server.

Versions Latest versions of signals-derived-data (1.24.3) and signalk-server-node (1.29) at the time of writing.

fabdrol commented 4 years ago

My guess is that the problem is caused by this line: https://github.com/SignalK/signalk-derived-data/blob/master/calcs/depthBelowKeel2.js#L4

The calculation takes the value for environment.depth.transducerToKeel.value only once; at start-up. This is problematic in my use case, and in situations where a vessel has a lifting keel with a sensor that informs environment.depth.transducerToKeel.value.

fabdrol commented 4 years ago

Just tested this, works for depth below keel