From de9610a4bf2d06c5dad5f78b6aa2e793e595f109 Mon Sep 17 00:00:00 2001 From: Mickael Date: Mon, 14 Sep 2020 13:08:32 +0200 Subject: [PATCH] add long timeout when get read --- .../AtlasOEMI2c.py | 32 +++++++++---------- .../CommonsI2c.py | 1 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/GreenPonik_Atlas_Scientific_OEM_i2c/AtlasOEMI2c.py b/GreenPonik_Atlas_Scientific_OEM_i2c/AtlasOEMI2c.py index c87fa45..840045f 100644 --- a/GreenPonik_Atlas_Scientific_OEM_i2c/AtlasOEMI2c.py +++ b/GreenPonik_Atlas_Scientific_OEM_i2c/AtlasOEMI2c.py @@ -110,24 +110,24 @@ class _AtlasOEMI2c: "device_led": 0x05, "device_sleep": 0x06, "device_new_reading": 0x07, - "device_calibration_msb": 0x08, # 0x08 - 0x0B 4 registers - "device_calibration_high": 0x09, # 0x08 - 0x0B 4 registers - "device_calibration_low": 0x0A, # 0x08 - 0x0B 4 registers - "device_calibration_lsb": 0x0B, # 0x08 - 0x0B 4 registers + "device_calibration_msb": 0x08, # 0x08 - 0x0B 4 registers + "device_calibration_high": 0x09, # 0x08 - 0x0B 4 registers + "device_calibration_low": 0x0A, # 0x08 - 0x0B 4 registers + "device_calibration_lsb": 0x0B, # 0x08 - 0x0B 4 registers "device_calibration_request": 0x0C, "device_calibration_confirm": 0x0D, - "device_temperature_comp_msb": 0x0E, # 0x0E - 0x11 4 registers - "device_temperature_comp_high": 0x0F, # 0x0E - 0x11 4 registers - "device_temperature_comp_low": 0x10, # 0x0E - 0x11 4 registers - "device_temperature_comp_lsb": 0x11, # 0x0E - 0x11 4 registers - "device_temperature_confirm_msb": 0x12, # 0x12 - 0x15 4 registers - "device_temperature_confirm_high": 0x13, # 0x12 - 0x15 4 registers - "device_temperature_confirm_low": 0x14, # 0x12 - 0x15 4 registers - "device_temperature_confirm_lsb": 0x15, # 0x12 - 0x15 4 registers - "device_ph_msb": 0x16, # 0x16 - 0x19 4 registers - "device_ph_high": 0x17, # 0x16 - 0x19 4 registers - "device_ph_low": 0x18, # 0x16 - 0x19 4 registers - "device_ph_lsb": 0x19, # 0x16 - 0x19 4 registers + "device_temperature_comp_msb": 0x0E, # 0x0E - 0x11 4 registers + "device_temperature_comp_high": 0x0F, # 0x0E - 0x11 4 registers + "device_temperature_comp_low": 0x10, # 0x0E - 0x11 4 registers + "device_temperature_comp_lsb": 0x11, # 0x0E - 0x11 4 registers + "device_temperature_confirm_msb": 0x12, # 0x12 - 0x15 4 registers + "device_temperature_confirm_high": 0x13, # 0x12 - 0x15 4 registers + "device_temperature_confirm_low": 0x14, # 0x12 - 0x15 4 registers + "device_temperature_confirm_lsb": 0x15, # 0x12 - 0x15 4 registers + "device_ph_msb": 0x16, # 0x16 - 0x19 4 registers + "device_ph_high": 0x17, # 0x16 - 0x19 4 registers + "device_ph_low": 0x18, # 0x16 - 0x19 4 registers + "device_ph_lsb": 0x19, # 0x16 - 0x19 4 registers } ONE_BYTE_READ = 0x01 diff --git a/GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py b/GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py index ae14bc1..927aaf0 100644 --- a/GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py +++ b/GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py @@ -98,6 +98,7 @@ def get_read(self): @return float the sensor value """ self.set_wakeup_sleep_mode(0x01) # wake device before read + time.sleep(self._long_timeout) if "EC" == self.moduletype: rawhex = self.read( self.OEM_EC_REGISTERS["device_ec_msb"],