Skip to content

Commit

Permalink
add long timeout when get read
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickael committed Sep 14, 2020
1 parent de93ae8 commit de9610a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
32 changes: 16 additions & 16 deletions GreenPonik_Atlas_Scientific_OEM_i2c/AtlasOEMI2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit de9610a

Please sign in to comment.