@@ -117,12 +117,9 @@ def _get_pulses(self):
117117 # time out after 1/4 second
118118 tmono = time .monotonic ()
119119 while True :
120- #if len(pulse_in) >= 82:
121- # break
122120 if time .monotonic ()- tmono > 0.25 : # time out after 1/4 seconds
123121 break
124122
125- #print(len(pulse_in))
126123 pulse_in .pause ()
127124 while pulse_in :
128125 pulses .append (pulse_in .popleft ())
@@ -145,22 +142,19 @@ def measure(self):
145142 self ._last_called = time .monotonic ()
146143
147144 pulses = self ._get_pulses ()
148- #print(pulses)
149- #print(len(pulses))
150145
151146 if len (pulses ) >= 80 :
152147 buf = array .array ('B' )
153148 for byte_start in range (0 , 80 , 16 ):
154149 buf .append (self ._pulses_to_binary (pulses , byte_start , byte_start + 16 ))
155- #print(buf)
156150
157151 # humidity is 2 bytes
158152 if self ._dht11 :
159153 self ._humidity = buf [0 ]
160154 else :
161155 self ._humidity = ((buf [0 ]<< 8 ) | buf [1 ]) / 10
162156
163- # tempature is 2 bytes
157+ # temperature is 2 bytes
164158 if self ._dht11 :
165159 self ._temperature = buf [2 ]
166160 else :
@@ -174,17 +168,11 @@ def measure(self):
174168 # checksum is the last byte
175169 if chk_sum & 0xff != buf [4 ]:
176170 # check sum failed to validate
177- #print(pulses)
178171 raise RuntimeError ("Checksum did not validate. Try again." )
179- #print("checksum did not match. Temp: {} Humidity: {} Checksum:{}"
180- #.format(self._temperature,self._humidity,bites[4]))
181172
182- # checksum matches
183- #print("Temp: {} C Humidity: {}% ".format(self._temperature, self._humidity))
184173
185174 else :
186175 raise RuntimeError ("A full buffer was not returned. Try again." )
187- #print("did not get a full return. number returned was: {}".format(len(r)))
188176
189177 @property
190178 def temperature (self ):
0 commit comments