signalk-racer 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReleaseNotes.md +4 -0
- package/index.js +31 -9
- package/package.json +1 -1
package/ReleaseNotes.md
CHANGED
package/index.js
CHANGED
|
@@ -50,6 +50,7 @@ module.exports = (app) => {
|
|
|
50
50
|
{
|
|
51
51
|
"path": "navigation.racing.startLineLength",
|
|
52
52
|
"value": {
|
|
53
|
+
"type": "number",
|
|
53
54
|
"units": "m",
|
|
54
55
|
"description": "Length of the start line",
|
|
55
56
|
"displayName": "Length of the start line",
|
|
@@ -59,6 +60,7 @@ module.exports = (app) => {
|
|
|
59
60
|
{
|
|
60
61
|
"path": "navigation.racing.stbLineBias",
|
|
61
62
|
"value": {
|
|
63
|
+
"type": "number",
|
|
62
64
|
"units": "m",
|
|
63
65
|
"description": "Bias of the start line for the starboard end",
|
|
64
66
|
"displayName": "Bias of the start line for the starboard end",
|
|
@@ -68,6 +70,7 @@ module.exports = (app) => {
|
|
|
68
70
|
{
|
|
69
71
|
"path": "navigation.racing.nextLegHeading",
|
|
70
72
|
"value": {
|
|
73
|
+
"type": "number",
|
|
71
74
|
"units": "rad",
|
|
72
75
|
"description": "Heading of the next leg of the course",
|
|
73
76
|
"displayName": "Next Heading",
|
|
@@ -77,12 +80,26 @@ module.exports = (app) => {
|
|
|
77
80
|
{
|
|
78
81
|
"path": "navigation.racing.nextLegTrueWindAngle",
|
|
79
82
|
"value": {
|
|
83
|
+
"type": "number",
|
|
80
84
|
"units": "rad",
|
|
81
85
|
"description": "TWA on the next leg of the course",
|
|
82
86
|
"displayName": "Next TWA",
|
|
83
87
|
"shortName": "NextTWA",
|
|
84
88
|
}
|
|
85
89
|
},
|
|
90
|
+
{
|
|
91
|
+
"path": "navigation.racing.startTime",
|
|
92
|
+
"value": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"units": "RFC 3339 (UTC)",
|
|
95
|
+
"example": "2014-04-10T08:33:53.123Z",
|
|
96
|
+
"format": "date-time",
|
|
97
|
+
"pattern" : ".*Z$",
|
|
98
|
+
"description": "Time of the race start in RFC 3339 UTC only format ",
|
|
99
|
+
"displayName": "Start Time",
|
|
100
|
+
"shortName": "StartTime",
|
|
101
|
+
}
|
|
102
|
+
},
|
|
86
103
|
]
|
|
87
104
|
}
|
|
88
105
|
]
|
|
@@ -461,17 +478,21 @@ module.exports = (app) => {
|
|
|
461
478
|
return;
|
|
462
479
|
}
|
|
463
480
|
|
|
464
|
-
state.timeToStart
|
|
465
|
-
|
|
481
|
+
state.timeToStart = Math.max(state.timeToStart + delta, 0);
|
|
482
|
+
|
|
483
|
+
if (state.timerRunning) {
|
|
484
|
+
let now = Date.now();
|
|
485
|
+
state.startTime = new Date(now - (now % 1000) + state.timeToStart * 1000).toISOString();
|
|
486
|
+
}
|
|
466
487
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
488
|
+
const deltas = [
|
|
489
|
+
{ path: 'navigation.racing.timeToStart', value: state.timeToStart }
|
|
490
|
+
];
|
|
491
|
+
if (state.timerRunning && state.startTime) {
|
|
492
|
+
deltas.push({path: 'navigation.racing.startTime', value: state.startTime });
|
|
493
|
+
}
|
|
494
|
+
sendDeltas(deltas);
|
|
470
495
|
|
|
471
|
-
sendDeltas([
|
|
472
|
-
{path: 'navigation.racing.timeToStart', value: state.timeToStart},
|
|
473
|
-
{path: 'navigation.racing.startTime', value: adjustedStart}
|
|
474
|
-
]);
|
|
475
496
|
return complete(callback, 200, 'adjust timer: OK');
|
|
476
497
|
}
|
|
477
498
|
|
|
@@ -480,6 +501,7 @@ module.exports = (app) => {
|
|
|
480
501
|
}
|
|
481
502
|
}
|
|
482
503
|
} catch (err) {
|
|
504
|
+
app.debug('startTimerCommand:', JSON.stringify(err));
|
|
483
505
|
return complete(callback, 500, 'Failed to command timer: ' + JSON.stringify(err));
|
|
484
506
|
}
|
|
485
507
|
}
|