Skip to content

Commit 913cccf

Browse files
Merge pull request #22 from cuplsensor/dev
Dev
2 parents 9cc9b60 + 4bb3ac2 commit 913cccf

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setuptools.setup(
88
name="cuplcodec",
9-
version="2.0.4",
9+
version="2.0.6",
1010
author="Malcolm Mackay",
1111
author_email="malcolm@plotsensor.com",
1212
description="Package for creating and decoding URLs that contain temperature and humidity samples.",

wscodec/encoder/pyencoder/instrumented.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def temp_degc_to_raw(self, degc):
122122
""" Converts degrees C to a raw ADC value for the Texas HDC2010. """
123123
return int((degc + 40) * 4096 / 165)
124124

125-
126125
def rh_percent_to_raw(self, rhpc):
127126
""" Converts from relative humidity in percent to a raw ADC value for the Texas HDC2010. """
128127
return int((rhpc * 4096) / 100)
@@ -143,6 +142,28 @@ def rhsample(self, countermax, counterstep):
143142
rawrh = self.rh_percent_to_raw(counter)
144143
yield {'adc': rawrh, 'ref': counter}
145144

145+
def pushsamplelist(self, trhlist: list):
146+
"""
147+
148+
:param trhlist: a list of dictionaries each containing temperature and relative humidity keys.
149+
:return: None
150+
"""
151+
for smpldict in trhlist:
152+
tempdegc = smpldict['temp']
153+
rhpc = smpldict['rh']
154+
tempraw = self.temp_degc_to_raw(tempdegc)
155+
rhraw = self.rh_percent_to_raw(rhpc)
156+
# rhraw is ignored (set to -1) inside enc_pushsample if the format is temperature only.
157+
self.ffimodule.lib.enc_pushsample(tempraw, rhraw)
158+
159+
def updateendstop(self, minutes: int):
160+
""" Update the endstop with minutes elapsed since the most recent sample.
161+
162+
:param minutes: Minutes elapsed since the most recent sample.
163+
:return: None
164+
"""
165+
self.ffimodule.lib.enc_setelapsed(minutes)
166+
146167

147168
class InstrumentedSampleT(InstrumentedSample):
148169
FORMAT_HDC2021_TEMPONLY = 2
@@ -219,26 +240,5 @@ def pushsamples(self, num):
219240
self.ffimodule.lib.enc_pushsample(tempsmpl['adc'], rhsmpl['adc'])
220241
return inlist
221242

222-
def pushsamplelist(self, trhlist: list):
223-
"""
224-
225-
:param trhlist: a list of dictionaries each containing temperature and relative humidity keys.
226-
:return: None
227-
"""
228-
for smpldict in trhlist:
229-
tempdegc = smpldict['temp']
230-
rhpc = smpldict['rh']
231-
tempraw = self.temp_degc_to_raw(tempdegc)
232-
rhraw = self.rh_percent_to_raw(rhpc)
233-
self.ffimodule.lib.enc_pushsample(tempraw, rhraw)
234-
235-
def updateendstop(self, minutes: int):
236-
""" Update the endstop with minutes elapsed since the most recent sample.
237-
238-
:param minutes: Minutes elapsed since the most recent sample.
239-
:return: None
240-
"""
241-
self.ffimodule.lib.enc_setelapsed(minutes)
242-
243243
def geturlqs(self):
244244
return self.eepromba.get_url_parsedqs()

0 commit comments

Comments
 (0)