@@ -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
@@ -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