@@ -196,72 +196,48 @@ def local_name(self):
196196 # is based on 3.4. Also, __func__ and __get()__ workarounds throw errors in
197197 # MicroPython. [^4]
198198
199- # 8-bit unsigned integer with scaling of 1 (no decimal places)
200- def _pack_uint8_x1 (self , object_id , value ):
199+ # 8-bit integer with scaling of 1 (no decimal places)
200+ def _pack_int8_x1 (self , object_id , value ):
201201 return pack ("BB" , object_id , round (value ))
202202
203- # 8-bit unsigned integer with scaling of 10 (1 decimal place)
204- def _pack_uint8_x10 (self , object_id , value ):
203+ # 8-bit integer with scaling of 10 (1 decimal place)
204+ def _pack_int8_x10 (self , object_id , value ):
205205 return pack ("BB" , object_id , round (value * 10 ))
206206
207- # 8-bit signed integer with scalling of 1 (no decimal places)
208- def _pack_sint8_x1 (self , object_id , value ):
209- return pack ("BB" , object_id , round (value ))
210-
211- # 16-bit unsigned integer with scalling of 1 (no decimal places)
212- def _pack_uint16_x1 (self , object_id , value ):
207+ # 16-bit integer with scalling of 1 (no decimal places)
208+ def _pack_int16_x1 (self , object_id , value ):
213209 return pack ("<BH" , object_id , round (value ))
214210
215- # 16-bit unsigned integer with scalling of 10 (1 decimal place)
216- def _pack_uint16_x10 (self , object_id , value ):
211+ # 16-bit integer with scalling of 10 (1 decimal place)
212+ def _pack_int16_x10 (self , object_id , value ):
217213 return pack ("<BH" , object_id , round (value * 10 ))
218214
219- # 16-bit unsigned integer with scalling of 100 (2 decimal places)
220- def _pack_uint16_x100 (self , object_id , value ):
215+ # 16-bit integer with scalling of 100 (2 decimal places)
216+ def _pack_int16_x100 (self , object_id , value ):
221217 return pack ("<BH" , object_id , round (value * 100 ))
222218
223- # 16-bit unsigned integer with scalling of 1000 (3 decimal places)
224- def _pack_uint16_x1000 (self , object_id , value ):
219+ # 16-bit integer with scalling of 1000 (3 decimal places)
220+ def _pack_int16_x1000 (self , object_id , value ):
225221 return pack ("<BH" , object_id , round (value * 1000 ))
226222
227- # 16-bit signed integer with scalling of 1 (no decimal places)
228- def _pack_sint16_x1 (self , object_id , value ):
229- return pack ("<BH" , object_id , round (value ))
230-
231- # 16-bit signed integer with scalling of 10 (1 decimal place)
232- def _pack_sint16_x10 (self , object_id , value ):
233- return pack ("<Bh" , object_id , round (value * 10 ))
234-
235- # 16-bit signed integer with scalling of 100 (2 decimal places)
236- def _pack_sint16_x100 (self , object_id , value ):
237- return pack ("<Bh" , object_id , round (value * 100 ))
238-
239- # 16-bit signed integer with scalling of 1000 (3 decimal places)
240- def _pack_sint16_x1000 (self , object_id , value ):
241- return pack ("<Bh" , object_id , round (value * 1000 ))
242-
243- # 24-bit unsigned integer with scaling of 100 (2 decimal places)
244- def _pack_uint24_x100 (self , object_id , value ):
223+ # 24-bit integer with scaling of 100 (2 decimal places)
224+ def _pack_int24_x100 (self , object_id , value ):
245225 return pack ("<BL" , object_id , round (value * 100 ))[:- 1 ]
246226
247- # 24-bit unsigned integer with scaling of 1000 (3 decimal places)
248- def _pack_uint24_x1000 (self , object_id , value ):
227+ # 24-bit integer with scaling of 1000 (3 decimal places)
228+ def _pack_int24_x1000 (self , object_id , value ):
249229 return pack ("<BL" , object_id , round (value * 1000 ))[:- 1 ]
250230
251- # 32-bit unsigned integer with scaling of 1 (no decimal places)
252- def _pack_uint32_x1 (self , object_id , value ):
231+ # 32-bit integer with scaling of 1 (no decimal places)
232+ def _pack_int32_x1 (self , object_id , value ):
253233 return pack ("<BL" , object_id , round (value ))
254234
255- # 32-bit unsigned integer with scaling of 1000 (3 decimal places)
256- def _pack_uint32_x1000 (self , object_id , value ):
235+ # 32-bit integer with scaling of 1000 (3 decimal places)
236+ def _pack_int32_x1000 (self , object_id , value ):
257237 return pack ("<BL" , object_id , round (value * 1000 ))
258238
259- # 32-bit signed integer with scalling of 1 (no decimal places)
260- def _pack_sint32_x1 (self , object_id , value ):
261- return pack ("<BL" , object_id , round (value ))
262-
263- # 48-bit unsigned integer with scaling of 1 (no decimal places)
264- def _pack_uint48_x1 (self , object_id , value ):
239+ # 48-bit integer with scaling of 1 (no decimal places)
240+ def _pack_int48_x1 (self , object_id , value ):
265241 return pack ("<BQ" , object_id , value )[:- 2 ]
266242
267243 def _pack_raw_text (self , object_id , value ):
@@ -270,60 +246,60 @@ def _pack_raw_text(self, object_id, value):
270246 return packed_value
271247
272248 _object_id_functions = {
273- BATTERY_UINT8_X1 : _pack_uint8_x1 ,
274- TEMPERATURE_SINT16_X100 : _pack_sint16_x100 ,
275- HUMIDITY_UINT16_X100 : _pack_uint16_x100 ,
276- PRESSURE_UINT24_X100 : _pack_uint24_x100 ,
277- ILLUMINANCE_UINT24_X100 : _pack_uint24_x100 ,
278- MASS_KG_UINT16_X100 : _pack_uint16_x100 ,
279- MASS_LB_UINT16_X100 : _pack_uint16_x100 ,
280- DEWPOINT_SINT16_X100 : _pack_sint16_x100 ,
281- COUNT_UINT8_X1 : _pack_uint8_x1 ,
282- ENERGY_UINT24_X1000 : _pack_uint24_x1000 ,
283- POWER_UINT24_X100 : _pack_uint24_x100 ,
284- VOLTAGE_UINT16_X1000 : _pack_uint16_x1000 ,
285- PM2_5_UINT16_X1 : _pack_uint16_x1 ,
286- PM10_UINT16_X1 : _pack_uint16_x1 ,
287- CO2_UINT16_X1 : _pack_uint16_x1 ,
288- TVOC_UINT16_X1 : _pack_uint16_x1 ,
289- MOISTURE_UINT16_X100 : _pack_uint16_x100 ,
290- HUMIDITY_UINT8_X1 : _pack_uint8_x1 ,
291- MOISTURE_UINT8_X1 : _pack_uint8_x1 ,
292- COUNT_UINT16_X1 : _pack_uint16_x1 ,
293- COUNT_UINT32_X1 : _pack_uint32_x1 ,
294- ROTATION_SINT16_X10 : _pack_sint16_x10 ,
295- DISTANCE_MM_UINT16_X1 : _pack_uint16_x1 ,
296- DISTANCE_M_UINT16_X10 : _pack_uint16_x10 ,
297- DURATION_UINT24_X1000 : _pack_uint24_x1000 ,
298- CURRENT_UINT16_X1000 : _pack_uint16_x1000 ,
299- SPEED_UINT16_X100 : _pack_sint16_x100 ,
300- TEMPERATURE_SINT16_X10 : _pack_sint16_x10 ,
301- UV_INDEX_UINT8_X10 : _pack_uint8_x10 ,
302- VOLUME_L_UINT16_X10 : _pack_uint16_x10 ,
303- VOLUME_ML_UINT16_X1 : _pack_uint16_x1 ,
304- VOLUME_FLOW_RATE_X1000 : _pack_uint16_x1000 ,
305- VOLTAGE_UINT16_X10 : _pack_uint16_x10 ,
306- GAS_UINT24_X1000 : _pack_uint24_x1000 ,
307- GAS_UINT32_X1000 : _pack_uint32_x1000 ,
308- ENERGY_UINT32_X1000 : _pack_uint32_x1000 ,
309- VOLUME_UINT32_X1000 : _pack_uint32_x1000 ,
310- WATER_UINT32_X1000 : _pack_uint32_x1000 ,
311- TIMESTAMP_UINT48_X1 : _pack_uint48_x1 ,
312- ACCELERATION_UINT16_X1000 : _pack_uint16_x1000 ,
313- GYROSCOPE_UINT16_X1000 : _pack_uint16_x1000 ,
249+ BATTERY_UINT8_X1 : _pack_int8_x1 ,
250+ TEMPERATURE_SINT16_X100 : _pack_int16_x100 ,
251+ HUMIDITY_UINT16_X100 : _pack_int16_x100 ,
252+ PRESSURE_UINT24_X100 : _pack_int24_x100 ,
253+ ILLUMINANCE_UINT24_X100 : _pack_int24_x100 ,
254+ MASS_KG_UINT16_X100 : _pack_int16_x100 ,
255+ MASS_LB_UINT16_X100 : _pack_int16_x100 ,
256+ DEWPOINT_SINT16_X100 : _pack_int16_x100 ,
257+ COUNT_UINT8_X1 : _pack_int8_x1 ,
258+ ENERGY_UINT24_X1000 : _pack_int24_x1000 ,
259+ POWER_UINT24_X100 : _pack_int24_x100 ,
260+ VOLTAGE_UINT16_X1000 : _pack_int16_x1000 ,
261+ PM2_5_UINT16_X1 : _pack_int16_x1 ,
262+ PM10_UINT16_X1 : _pack_int16_x1 ,
263+ CO2_UINT16_X1 : _pack_int16_x1 ,
264+ TVOC_UINT16_X1 : _pack_int16_x1 ,
265+ MOISTURE_UINT16_X100 : _pack_int16_x100 ,
266+ HUMIDITY_UINT8_X1 : _pack_int8_x1 ,
267+ MOISTURE_UINT8_X1 : _pack_int8_x1 ,
268+ COUNT_UINT16_X1 : _pack_int16_x1 ,
269+ COUNT_UINT32_X1 : _pack_int32_x1 ,
270+ ROTATION_SINT16_X10 : _pack_int16_x10 ,
271+ DISTANCE_MM_UINT16_X1 : _pack_int16_x1 ,
272+ DISTANCE_M_UINT16_X10 : _pack_int16_x10 ,
273+ DURATION_UINT24_X1000 : _pack_int24_x1000 ,
274+ CURRENT_UINT16_X1000 : _pack_int16_x1000 ,
275+ SPEED_UINT16_X100 : _pack_int16_x100 ,
276+ TEMPERATURE_SINT16_X10 : _pack_int16_x10 ,
277+ UV_INDEX_UINT8_X10 : _pack_int8_x10 ,
278+ VOLUME_L_UINT16_X10 : _pack_int16_x10 ,
279+ VOLUME_ML_UINT16_X1 : _pack_int16_x1 ,
280+ VOLUME_FLOW_RATE_X1000 : _pack_int16_x1000 ,
281+ VOLTAGE_UINT16_X10 : _pack_int16_x10 ,
282+ GAS_UINT24_X1000 : _pack_int24_x1000 ,
283+ GAS_UINT32_X1000 : _pack_int32_x1000 ,
284+ ENERGY_UINT32_X1000 : _pack_int32_x1000 ,
285+ VOLUME_UINT32_X1000 : _pack_int32_x1000 ,
286+ WATER_UINT32_X1000 : _pack_int32_x1000 ,
287+ TIMESTAMP_UINT48_X1 : _pack_int48_x1 ,
288+ ACCELERATION_UINT16_X1000 : _pack_int16_x1000 ,
289+ GYROSCOPE_UINT16_X1000 : _pack_int16_x1000 ,
314290 TEXT_BYTES : _pack_raw_text ,
315291 RAW_BYTES : _pack_raw_text ,
316- VOLUME_STORAGE_UINT32_X1000 : _pack_uint32_x1000 ,
317- CONDUCTIVITY_UINT16_X1 : _pack_uint16_x1 ,
318- TEMPERATURE_SINT8_X1 : _pack_sint8_x1 ,
319- COUNT_SINT8_X1 : _pack_sint8_x1 ,
320- COUNT_SINT16_X1 : _pack_sint16_x1 ,
321- COUNT_SINT32_X1 : _pack_sint32_x1 ,
322- POWER_SINT16_X100 : _pack_sint16_x100 ,
323- CURRENT_SINT16_X1000 : _pack_sint16_x1000 ,
324- DIRECTION_UINT16_X100 : _pack_uint16_x100 ,
325- PRECIPITATION_UINT16_X1 : _pack_uint16_x1 ,
326- CHANNEL_UINT8_X1 : _pack_uint8_x1
292+ VOLUME_STORAGE_UINT32_X1000 : _pack_int32_x1000 ,
293+ CONDUCTIVITY_UINT16_X1 : _pack_int16_x1 ,
294+ TEMPERATURE_SINT8_X1 : _pack_int8_x1 ,
295+ COUNT_SINT8_X1 : _pack_int8_x1 ,
296+ COUNT_SINT16_X1 : _pack_int16_x1 ,
297+ COUNT_SINT32_X1 : _pack_int32_x1 ,
298+ POWER_SINT16_X100 : _pack_int16_x100 ,
299+ CURRENT_SINT16_X1000 : _pack_int16_x1000 ,
300+ DIRECTION_UINT16_X100 : _pack_int16_x100 ,
301+ PRECIPITATION_UINT16_X1 : _pack_int16_x1 ,
302+ CHANNEL_UINT8_X1 : _pack_int8_x1
327303 }
328304
329305 # Concatenate an arbitrary number of sensor readings using parameters
0 commit comments