Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Jan 4, 2024
1 parent 5110d32 commit f4ae6c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
27 changes: 16 additions & 11 deletions calcs/eta.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,37 @@ module.exports = function (app) {
date = new Date()
}

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

// app.debug(`Using datetime: ${date} ms to point : ${timetopoint} currentms: ${datems}`)
var etams = datems + timetopoint
// app.debug(`eta in ms: ${etams} ms to point : ${timetopoint} currentms: ${datems}`)
// app.debug(`Using datetime: ${date} ms to point : ${timetopoint} currentms: ${datems}`)
var etams = datems + timetopoint
// app.debug(`eta in ms: ${etams} ms to point : ${timetopoint} currentms: ${datems}`)

if (velocityMadeGood > 0) {
var etad = new Date(parseInt(etams))
var eta = etad.toISOString()
var ttg = Math.floor((timetopoint / 1000));
var ttg = Math.floor(timetopoint / 1000)
} else {
var eta = null
var ttg = null
}
// app.debug(`what is eta: ${eta} etams: ${etams} etad: ${etad}`)
// app.debug(`what is eta: ${eta} etams: ${etams} etad: ${etad}`)

return [
{
path: 'navigation.courseGreatCircle.nextPoint.estimatedTimeOfArrival', value: eta
path: 'navigation.courseGreatCircle.nextPoint.estimatedTimeOfArrival',
value: eta
},
{
path: 'navigation.courseGreatCircle.nextPoint.timeToGo', value: ttg
path: 'navigation.courseGreatCircle.nextPoint.timeToGo',
value: ttg
},
{
path: 'navigation.courseGreatCircle.nextPoint.eta', value: eta
{
path: 'navigation.courseGreatCircle.nextPoint.eta',
value: eta
}
]
}
Expand Down
7 changes: 6 additions & 1 deletion calcs/vmg_wind_stw.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ module.exports = function (app) {
'navigation.speedThroughWater'
],
calculator: function (angleTrueWater, speedThroughWater) {
return [ { path: 'performance.velocityMadeGood', value: Math.cos(angleTrueWater) * speedThroughWater } ]
return [
{
path: 'performance.velocityMadeGood',
value: Math.cos(angleTrueWater) * speedThroughWater
}
]
}
}
}

0 comments on commit f4ae6c4

Please sign in to comment.