From b00d40ecd48fc03e80b04f9f1dc92b806f2f1cac Mon Sep 17 00:00:00 2001 From: wweiye <275241708@qq.com> Date: Thu, 30 Nov 2023 15:23:59 +0800 Subject: [PATCH] change sensors address to 01 --- hardware-testing/hardware_testing/drivers/asair_sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hardware-testing/hardware_testing/drivers/asair_sensor.py b/hardware-testing/hardware_testing/drivers/asair_sensor.py index 4e30c743045..f1d694cf105 100644 --- a/hardware-testing/hardware_testing/drivers/asair_sensor.py +++ b/hardware-testing/hardware_testing/drivers/asair_sensor.py @@ -185,8 +185,9 @@ def get_reading(self) -> Reading: def get_serial(self) -> str: """Read the device ID register.""" - serial_addr = "0A" - data_packet = "{}0300000002{}".format(serial_addr, addrs[serial_addr]) + data_packet = "{}0300000002{}".format( + self._sensor_address, addrs[self._sensor_address] + ) log.debug(f"sending {data_packet}") command_bytes = codecs.decode(data_packet.encode(), "hex") try: @@ -197,6 +198,7 @@ def get_serial(self) -> str: length = self._th_sensor.inWaiting() res = self._th_sensor.read(length) + res = codecs.encode(res, "hex") log.debug(f"received {res}") dev_id = res[6:14] return dev_id.decode()