@@ -117,12 +117,9 @@ def _get_pulses(self):
117
117
# time out after 1/4 second
118
118
tmono = time .monotonic ()
119
119
while True :
120
- #if len(pulse_in) >= 82:
121
- # break
122
120
if time .monotonic ()- tmono > 0.25 : # time out after 1/4 seconds
123
121
break
124
122
125
- #print(len(pulse_in))
126
123
pulse_in .pause ()
127
124
while pulse_in :
128
125
pulses .append (pulse_in .popleft ())
@@ -145,22 +142,19 @@ def measure(self):
145
142
self ._last_called = time .monotonic ()
146
143
147
144
pulses = self ._get_pulses ()
148
- #print(pulses)
149
- #print(len(pulses))
150
145
151
146
if len (pulses ) >= 80 :
152
147
buf = array .array ('B' )
153
148
for byte_start in range (0 , 80 , 16 ):
154
149
buf .append (self ._pulses_to_binary (pulses , byte_start , byte_start + 16 ))
155
- #print(buf)
156
150
157
151
# humidity is 2 bytes
158
152
if self ._dht11 :
159
153
self ._humidity = buf [0 ]
160
154
else :
161
155
self ._humidity = ((buf [0 ]<< 8 ) | buf [1 ]) / 10
162
156
163
- # tempature is 2 bytes
157
+ # temperature is 2 bytes
164
158
if self ._dht11 :
165
159
self ._temperature = buf [2 ]
166
160
else :
@@ -174,17 +168,11 @@ def measure(self):
174
168
# checksum is the last byte
175
169
if chk_sum & 0xff != buf [4 ]:
176
170
# check sum failed to validate
177
- #print(pulses)
178
171
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]))
181
172
182
- # checksum matches
183
- #print("Temp: {} C Humidity: {}% ".format(self._temperature, self._humidity))
184
173
185
174
else :
186
175
raise RuntimeError ("A full buffer was not returned. Try again." )
187
- #print("did not get a full return. number returned was: {}".format(len(r)))
188
176
189
177
@property
190
178
def temperature (self ):
0 commit comments