@@ -592,6 +592,37 @@ function parseSKYDEW(xdata) {
592592 return _output
593593}
594594
595+ function parseKnmiTachometer ( xdata ) {
596+ // KNMI Tachometer for Vaisala OIF411
597+ //
598+ // Sample data: 80022B5A1EE4001384A407F8 (length = 24 characters)
599+
600+ // Run some checks over the input
601+ if ( xdata . length != 24 ) {
602+ // Invalid dataset
603+ return { } ;
604+ }
605+
606+ if ( xdata . substr ( 0 , 2 ) !== '80' ) {
607+ // Not a KNMI Tachometer (shouldn't get here)
608+ return { } ;
609+ }
610+
611+ var _output = { } ;
612+
613+ // uptime (in seconds) of the arduino tachometer board
614+ _output [ 'tacho_uptime' ] = ( parseInt ( xdata . substr ( 4 , 8 ) , 16 ) * 8 / 1000000 ) . toFixed ( ) ;
615+
616+ // time the Vaisala OIF411 motor needs to make 400 rounds
617+ _delta = parseInt ( xdata . substr ( 12 , 8 ) , 16 ) * 8 / 1000000 ;
618+ _output [ 'tacho_delta' ] = _delta . toFixed ( 3 ) ;
619+
620+ // calculated rounds per second
621+ _output [ 'tacho_rps' ] = ( 400 / _delta ) . toFixed ( 3 ) ;
622+
623+ return _output
624+ }
625+
595626function parseXDATA ( data , pressure , temperature ) {
596627 // Accept an XDATA string, or multiple XDATA entries, delimited by '#'
597628 // Attempt to parse each one, and return an object
@@ -683,8 +714,9 @@ function parseXDATA(data, pressure, temperature){
683714 // POPS
684715 if ( ! _instruments . includes ( "POPS" ) ) _instruments . push ( 'POPS' ) ;
685716 } else if ( _instrument === '80' ) {
686- // Unknown!
687- //console.log("Saw unknown XDATA instrument 0x80.")
717+ // KNMI Tachometer
718+ _xdata_temp = parseKnmiTachometer ( _current_xdata ) ;
719+ _output = Object . assign ( _output , _xdata_temp ) ;
688720 } else {
689721 // Unknown!
690722
0 commit comments