Skip to content

Commit

Permalink
Create DPT-surface.js (#102)
Browse files Browse the repository at this point in the history
Using surfaceToTransducer to calculate depth
  • Loading branch information
davidsanner authored Dec 18, 2023
1 parent 432b316 commit 913e5b2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions sentences/DPT-surface.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
DPT - Depth of Water
$--DPT,x.x,x.x*hh
Fields:
- Water depth relative to transducer, meters
- Offset from transducer, meters. Positive means distance from transducer to water line, negative means distance from transducer to keel
- Checksum
*/
// NMEA0183 Encoder DPT $IIDPT,9.2,1.1*4B
const nmea = require('../nmea.js')
module.exports = function (app) {
return {
sentence: 'DPT',
title: 'DPT - Depth at Surface (using surfaceToTransducer)',
keys: [
'environment.depth.belowTransducer',
'environment.depth.surfaceToTransducer'
],
f: function dpt (belowTransducer, surfaceToTransducer) {
return nmea.toSentence([
'$IIDPT',
belowTransducer.toFixed(2),
surfaceToTransducer.toFixed(3)
])
}
}
}

0 comments on commit 913e5b2

Please sign in to comment.