Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding critical temp features #17

Merged
merged 2 commits into from
Dec 6, 2021
Merged

Adding critical temp features #17

merged 2 commits into from
Dec 6, 2021

Conversation

jposada202020
Copy link
Contributor

@jposada202020 jposada202020 commented May 17, 2021

Changes

  1. Adding properties for critical temperatures, and hysteresis
  2. Small doc changes

Testing Code

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import adafruit_adt7410

# import adt7410_features

i2c_bus = board.I2C()
adt = adafruit_adt7410.ADT7410(i2c_bus, address=0x48)

print(adt.temperature)

print("Over Temperature Value", adt.high_temperature)
time.sleep(0.05)
adt.high_temperature = 28.1
time.sleep(0.05)
adt.comparator_mode = True
print("After setting High Temp Value", adt.high_temperature)
print("")
print("Under temperature Value", adt.low_temperature)
time.sleep(0.05)
adt.low_temperature = 14.74
time.sleep(0.05)
print("After Setting Low Temp Value", adt.low_temperature)
print("")
print("Critical temperature Value", adt.critical_temperature)
time.sleep(0.05)
adt.critical_temperature = 111
time.sleep(0.05)
print("After Setting Critical Temp Value", adt.critical_temperature)
print("")
print("Hysteresis Current Value", adt.hysteresis)
time.sleep(0.05)
adt.hysteresis = 1
time.sleep(0.05)
print("After Setting hysteresis Temp Value", adt.hysteresis)

print("validating over temperature alarm")
print(adt.temp_over_high)
print("")

while True:
    print("Temperature {} Temperature is over: {}".format(adt.temperature, adt.temp_over_high))
    time.sleep(4)

Expected Results

To achieve this raise the sensor temperature over 28.1 Celsius

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import adt7410_features
25.25
Over Temperature Value 64.0
After setting High Temp Value 28.0938

Under temperature Value 10.0
After Setting Low Temp Value 14.7344

Critical temperature Value 147.0
After Setting Critical Temp Value 111.0

Hysteresis Current Value 5
After Setting hysteresis Temp Value 1
validating over temperature alarm
False

Temperature 25.25 Temperature is over: False
Temperature 25.25 Temperature is over: False
Temperature 27.3125 Temperature is over: False
Temperature 28.2031 Temperature is over: True
Temperature 28.0156 Temperature is over: True
Temperature 27.4531 Temperature is over: True
Temperature 27.2656 Temperature is over: True
Temperature 26.8125 Temperature is over: False
Temperature 26.625 Temperature is over: False

@jposada202020 jposada202020 requested a review from a team May 17, 2021 01:13
@jposada202020 jposada202020 added the enhancement New feature or request label May 17, 2021
@evaherrada evaherrada changed the base branch from master to main June 7, 2021 17:11
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Tested successfully with:

Adafruit CircuitPython 7.1.0-beta.0 on 2021-11-12; Adafruit PyPortal with samd51j20
Board ID:pyportal

Thanks for the new functionality @jposada202020

@FoamyGuy FoamyGuy merged commit aec528b into adafruit:main Dec 6, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 7, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADT7410 to 1.3.0 from 1.2.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_ADT7410#17 from jposada202020/adding_critical_temp_features
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_LTR390 to 1.1.3 from 1.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_LTR390#13 from caternuson/iss11
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver to 1.1.8 from 1.1.7:
  > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#15 from romilly/master
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Eddystone to 1.0.7 from 1.0.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Eddystone#15 from tekktrik/docfix/add-blinka-req
  > update rtd py version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants