@signalk/streams 4.3.0 → 4.4.1
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/autodetect.js +6 -0
- package/gpiod-seatalk.js +8 -4
- package/n2kAnalyzer.js +6 -2
- package/package.json +1 -1
package/autodetect.js
CHANGED
|
@@ -143,6 +143,12 @@ require('util').inherits(ToTimestamped, Transform)
|
|
|
143
143
|
// runs only once, self-assigns the actual transform functions
|
|
144
144
|
// on first call
|
|
145
145
|
ToTimestamped.prototype._transform = function (msg, encoding, done) {
|
|
146
|
+
//ignore empty lines in the beginning of the file, encountered in some cases
|
|
147
|
+
if (msg.trim().length === 0) {
|
|
148
|
+
done()
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
const line = msg.toString()
|
|
147
153
|
this.multiplexedFormat =
|
|
148
154
|
line.length > 16 && line.charAt(13) === ';' && line.split(';').length >= 3
|
package/gpiod-seatalk.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* You may obtain a copy of the License at
|
|
7
7
|
*
|
|
8
8
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
* Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
@@ -25,7 +25,7 @@ const Execute = require('./execute')
|
|
|
25
25
|
const cmd = `
|
|
26
26
|
import gpiod, sys, datetime, glob
|
|
27
27
|
|
|
28
|
-
ST_PIN =
|
|
28
|
+
ST_PIN = 4
|
|
29
29
|
|
|
30
30
|
ST_INVERT = 0 # 0=idle high, 1=idle low
|
|
31
31
|
ST_BITS = 9
|
|
@@ -318,9 +318,13 @@ class st1rx:
|
|
|
318
318
|
|
|
319
319
|
if __name__ == "__main__":
|
|
320
320
|
gpio = ST_PIN
|
|
321
|
-
if len(sys.argv) > 1:
|
|
321
|
+
if len(sys.argv) > 1 and isinstance(sys.argv[1], str) and sys.argv[1][:4]=="GPIO":
|
|
322
322
|
# Gpio, info as "GPIOnn", from GUI setup. Sensing the seatalk1 (yellow wire)
|
|
323
|
-
|
|
323
|
+
try:
|
|
324
|
+
gpio = int(sys.argv[1][4:])
|
|
325
|
+
except:
|
|
326
|
+
pass
|
|
327
|
+
|
|
324
328
|
pol = ST_INVERT
|
|
325
329
|
if len(sys.argv) > 2:
|
|
326
330
|
# Invert, inverted input from ST1, selected in the GUI
|
package/n2kAnalyzer.js
CHANGED
|
@@ -48,9 +48,13 @@ function N2KAnalyzer(options) {
|
|
|
48
48
|
const that = this
|
|
49
49
|
this.linereader.on('line', function (data) {
|
|
50
50
|
try {
|
|
51
|
-
parsed = JSON.parse(data)
|
|
51
|
+
let parsed = JSON.parse(data)
|
|
52
|
+
if (parsed.version) {
|
|
53
|
+
console.log('Connected to analyzer v' + parsed.version)
|
|
54
|
+
return
|
|
55
|
+
}
|
|
52
56
|
that.push(parsed)
|
|
53
|
-
options.app.emit(
|
|
57
|
+
options.app.emit(that.analyzerOutEvent, parsed)
|
|
54
58
|
} catch (ex) {
|
|
55
59
|
console.error(data)
|
|
56
60
|
console.error(ex.stack)
|