@@ -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
147168class InstrumentedSampleT (InstrumentedSample ):
148169 FORMAT_HDC2021_TEMPONLY = 2
@@ -180,17 +201,6 @@ def pushsamples(self, num):
180201 self .ffimodule .lib .enc_pushsample (tempsmpl ['adc' ], 0 )
181202 return inlist
182203
183- def pushsamplelist (self , tlist : list ):
184- """
185-
186- :param tlist: a list of dictionaries each containing temperature keys.
187- :return: None
188- """
189- for smpldict in tlist :
190- tempdegc = smpldict ['temp' ]
191- tempraw = self .temp_degc_to_raw (tempdegc )
192- self .ffimodule .lib .enc_pushsample (tempraw , 0 )
193-
194204
195205class InstrumentedSampleTRH (InstrumentedSample ):
196206 FORMAT_HDC2021_TRH = 1
@@ -230,26 +240,5 @@ def pushsamples(self, num):
230240 self .ffimodule .lib .enc_pushsample (tempsmpl ['adc' ], rhsmpl ['adc' ])
231241 return inlist
232242
233- def pushsamplelist (self , trhlist : list ):
234- """
235-
236- :param trhlist: a list of dictionaries each containing temperature and relative humidity keys.
237- :return: None
238- """
239- for smpldict in trhlist :
240- tempdegc = smpldict ['temp' ]
241- rhpc = smpldict ['rh' ]
242- tempraw = self .temp_degc_to_raw (tempdegc )
243- rhraw = self .rh_percent_to_raw (rhpc )
244- self .ffimodule .lib .enc_pushsample (tempraw , rhraw )
245-
246- def updateendstop (self , minutes : int ):
247- """ Update the endstop with minutes elapsed since the most recent sample.
248-
249- :param minutes: Minutes elapsed since the most recent sample.
250- :return: None
251- """
252- self .ffimodule .lib .enc_setelapsed (minutes )
253-
254243 def geturlqs (self ):
255244 return self .eepromba .get_url_parsedqs ()
0 commit comments