@@ -4,7 +4,7 @@ const eventEmitter = require('events').EventEmitter;
44
55module . exports = function ( pin , type ) {
66 const dht = Object . create ( new eventEmitter ( ) ) ;
7- const gpio = new Gpio ( pin , { mode : Gpio . OUTPUT , pullUpDown : Gpio . PUD_OFF } ;
7+ const gpio = new Gpio ( pin , { mode : Gpio . OUTPUT , pullUpDown : Gpio . PUD_OFF } ) ;
88
99 dht . reading = false ;
1010
@@ -22,12 +22,12 @@ module.exports = function(pin, type) {
2222 // cancel out if we are already reading
2323 return false ;
2424 }
25- dht . emmit ( 'start' ) ;
25+ dht . emit ( 'start' ) ;
2626 // Trigger a new relative humidity and temperature reading.
2727 // write low for 18 ms
2828 gpio . digitalWrite ( 0 ) ;
2929 // after that let the line go high and start reading
30- setTimeout ( ( ) => {
30+ setTimeout ( ( ) => {
3131 // reset all values
3232 bits = - 2 ; // initialized at -2 because the first 2 lows are the ack
3333 rhumHigh = 0 ;
@@ -47,7 +47,7 @@ module.exports = function(pin, type) {
4747 dht . reading = false ;
4848 gpio . disableAlert ( ) ;
4949 gpio . mode ( Gpio . OUTPUT ) ;
50- dht . emmit ( 'end' ) ;
50+ dht . emit ( 'end' ) ;
5151 }
5252
5353 gpio . on ( 'alert' , ( level , tick ) => {
@@ -57,7 +57,7 @@ module.exports = function(pin, type) {
5757 // bits are only accumulated on the low level
5858 if ( level == 0 ) {
5959 let diff = ( tick >> 0 ) - ( lastHighTick >> 0 ) ;
60-
60+
6161 // Edge length determines if bit is 1 or 0.
6262 let val = 0 ;
6363 // low bit is between 26 and 28 µs
@@ -75,13 +75,13 @@ module.exports = function(pin, type) {
7575 // we don't need to do anything with these
7676 } else if ( bits < 8 ) {
7777 // in humidity high byte
78- rhumHigh = ( rhumHigh << 1 ) + val ;
78+ rhumHigh = ( rhumHigh << 1 ) + val ;
7979 } else if ( bits < 16 ) {
8080 // in humidity low byte
81- rhumLow = ( rhumLow << 1 ) + val ;
81+ rhumLow = ( rhumLow << 1 ) + val ;
8282 } else if ( bits < 24 ) {
8383 // in temp high byte
84- tempHigh = ( tempHigh << 1 ) + val ;
84+ tempHigh = ( tempHigh << 1 ) + val ;
8585 } else if ( bits < 32 ) {
8686 // in temp low byte
8787 tempLow = ( tempLow << 1 ) + val ;
@@ -103,10 +103,10 @@ module.exports = function(pin, type) {
103103 let mult = ( tempHigh & 128 ) ? - 0.1 : 0.1 ;
104104 tempHigh = tempHigh & 127 ; // strip the sign bit
105105 let temp = ( ( tempHigh << 8 ) + tempLow ) * mult ;
106-
106+
107107 dht . emit ( 'result' , { temperature : temp , humidity : rhum } ) ;
108108 } else {
109- dht . emmit ( 'badChecksum' ) ;
109+ dht . emit ( 'badChecksum' ) ;
110110 }
111111 }
112112 }
0 commit comments