Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
18 changes: 10 additions & 8 deletions phypidaq/DS18B20Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

# import relevant pieces for DS18B20
from w1thermsensor import W1ThermSensor
from w1thermsensor import W1ThermSensor, Unit


class DS18B20Config(object):
Expand All @@ -21,18 +21,23 @@ def __init__(self, confdict=None):
# -- unit configuration DS18B20
if "Unit" in confdict:
if confdict["Unit"] == "DEGREES_F":
self.unit = W1ThermSensor.DEGREES_F
self.unit = Unit.DEGREES_F
self.ChanLims = [[14., 230.]]
elif confdict["Unit"] == "KELVIN":
self.unit = W1ThermSensor.KELVIN
self.unit = Unit.KELVIN
self.ChanLims = [[263.15, 383.15]]
else:
self.unit = W1ThermSensor.DEGREES_C
self.unit = Unit.DEGREES_C
self.ChanLims = [[-10., 110.]]
else:
self.unit = W1ThermSensor.DEGREES_C
self.unit = Unit.DEGREES_C
self.ChanLims = [[-10., 110.]]

self.DS18B20 = None

# provide configuration parameters
self.ChanNams = ['DS18B20']

def init(self):
# Hardware configuration:
try:
Expand All @@ -43,9 +48,6 @@ def init(self):
print(str(e))
sys.exit(1)

# provide configuration parameters
self.ChanNams = ['DS18B20']

def acquireData(self, buf):
buf[0] = self.DS18B20.get_temperature(self.unit)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ rpi-ws281x==4.3.0
RPi.GPIO==0.7.0
sysv-ipc==1.1.0
websockets==10.4
w1thermsensor==2.0.0
PyYAML
numpy