@@ -78,7 +78,7 @@ function parseOIF411(xdata, pressure){
7878 return { } ;
7979 }
8080
81- var _output = { 'xdata_instrument' : 'OIF411' } ;
81+ var _output = { } ;
8282
8383 // Instrument number is common to all XDATA types.
8484 _output [ 'oif411_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
@@ -148,7 +148,7 @@ function parseOIF411(xdata, pressure){
148148}
149149
150150function parseCFH ( xdata ) {
151- // Attempt to parse an XDATA string from an CFH Cryogenic Frostpoint Hygrometer
151+ // Attempt to parse an XDATA string from a CFH Cryogenic Frostpoint Hygrometer
152152 // Returns an object with parameters to be added to the sondes telemetry.
153153 //
154154 // References:
@@ -170,7 +170,7 @@ function parseCFH(xdata) {
170170 return { } ;
171171 }
172172
173- var _output = { 'xdata_instrument' : 'CFH' } ;
173+ var _output = { } ;
174174
175175 // Instrument number is common to all XDATA types.
176176 _output [ 'cfh_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
@@ -196,7 +196,7 @@ function parseCFH(xdata) {
196196}
197197
198198function parseCOBALD ( xdata ) {
199- // Attempt to parse an XDATA string from a Compact Optical Backscatter Aerosol Detector
199+ // Attempt to parse an XDATA string from a COBALD Compact Optical Backscatter Aerosol Detector
200200 // Returns an object with parameters to be added to the sondes telemetry.
201201 //
202202 // References:
@@ -218,7 +218,7 @@ function parseCOBALD(xdata) {
218218 return { } ;
219219 }
220220
221- var _output = { 'xdata_instrument' : 'COBALD' } ;
221+ var _output = { } ;
222222
223223 // Instrument number is common to all XDATA types.
224224 _output [ 'cobald_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
@@ -268,6 +268,7 @@ function parseXDATA(data, pressure){
268268 }
269269
270270 _output = { } ;
271+ _instruments = [ ] ;
271272 for ( xdata_i = 0 ; xdata_i < data_split . length ; xdata_i ++ ) {
272273 _current_xdata = data_split [ xdata_i ] ;
273274
@@ -280,53 +281,56 @@ function parseXDATA(data, pressure){
280281 // V7
281282 // 0102 time=1001 cnt=0 rpm=0
282283 // 0102 time=1001 cnt=7 rpm=419
283- _output [ 'xdata_instrument' ] = 'V7' ;
284+ if ( ! _instruments . includes ( "V7" ) ) _instruments . push ( 'V7' ) ;
284285 } else if ( _instrument === '05' ) {
285286 // OIF411
286287 _xdata_temp = parseOIF411 ( _current_xdata , pressure ) ;
287288 _output = Object . assign ( _output , _xdata_temp ) ;
289+ if ( ! _instruments . includes ( "OIF411" ) ) _instruments . push ( 'OIF411' ) ;
288290 } else if ( _instrument === '08' ) {
289291 // CFH
290292 _xdata_temp = parseCFH ( _current_xdata ) ;
291293 _output = Object . assign ( _output , _xdata_temp ) ;
294+ if ( ! _instruments . includes ( "CFH" ) ) _instruments . push ( 'CFH' ) ;
292295 } else if ( _instrument === '10' ) {
293296 // FPH
294- _output [ 'xdata_instrument' ] = 'FPH' ;
297+ if ( ! _instruments . includes ( "FPH" ) ) _instruments . push ( 'FPH' ) ;
295298 } else if ( _instrument === '19' ) {
296299 // COBALD
297300 _xdata_temp = parseCOBALD ( _current_xdata ) ;
298301 _output = Object . assign ( _output , _xdata_temp ) ;
302+ if ( ! _instruments . includes ( "COBALD" ) ) _instruments . push ( 'COBALD' ) ;
299303 } else if ( _instrument === '28' ) {
300304 // SLW
301- _output [ 'xdata_instrument' ] = 'SLW' ;
305+ if ( ! _instruments . includes ( "SLW" ) ) _instruments . push ( 'SLW' ) ;
302306 } else if ( _instrument === '38' ) {
303307 // POPS
304- _output [ 'xdata_instrument' ] = 'POPS' ;
308+ if ( ! _instruments . includes ( "POPS" ) ) _instruments . push ( 'POPS' ) ;
305309 } else if ( _instrument === '39' ) {
306310 // OPC
307- _output [ 'xdata_instrument' ] = 'OPC' ;
311+ if ( ! _instruments . includes ( "OPC" ) ) _instruments . push ( 'OPC' ) ;
308312 } else if ( _instrument === '3C' ) {
309313 // PCFH
310314 // 3c010000184b4b5754
311315 // 3c0103ce7b58647a98748befff
312316 // 3c010148719fff8e54b9af627e249fe0
313317 // 3c01028d696fff8db4b7865980cdbbb3
314- _output [ 'xdata_instrument' ] = 'PCFH' ;
318+ if ( ! _instruments . includes ( "PCFH" ) ) _instruments . push ( 'PCFH' ) ;
315319 } else if ( _instrument === '3D' ) {
316320 // FLASH-B
317- _output [ 'xdata_instrument' ] = 'FLASH-B' ;
321+ if ( ! _instruments . includes ( "FLASH-B" ) ) _instruments . push ( 'FLASH-B' ) ;
318322 } else if ( _instrument === '3E' ) {
319323 // TRAPS
320- _output [ 'xdata_instrument' ] = 'TRAPS' ;
324+ if ( ! _instruments . includes ( "TRAPS" ) ) _instruments . push ( 'TRAPS' ) ;
321325 } else if ( _instrument === '3F' ) {
322326 // SKYDEW
323- _output [ 'xdata_instrument' ] = 'SKYDEW' ;
327+ if ( ! _instruments . includes ( "SKYDEW" ) ) _instruments . push ( 'SKYDEW' ) ;
324328 } else if ( _instrument === '41' ) {
325329 // CICANUM
326- _output [ 'xdata_instrument' ] = 'CICANUM' ;
330+ if ( ! _instruments . includes ( "CICANUM" ) ) _instruments . push ( 'CICANUM' ) ;
327331 } else if ( _instrument === '45' ) {
328332 // POPS
329- _output [ 'xdata_instrument' ] = 'POPS' ;
333+ if ( ! _instruments . includes ( "POPS" ) ) _instruments . push ( 'POPS' ) ;
330334 } else if ( _instrument === '80' ) {
331335 // Unknown!
332336 //console.log("Saw unknown XDATA instrument 0x80.")
@@ -336,6 +340,8 @@ function parseXDATA(data, pressure){
336340 }
337341 }
338342
343+ _output [ "xdata_instrument" ] = _instruments ;
344+
339345 return _output
340346
341347}
0 commit comments