reading onewire sensors now works
This commit is contained in:
@@ -5,8 +5,15 @@ def read_one_thermo(filename):
|
|||||||
textfile = open(filename, 'r')
|
textfile = open(filename, 'r')
|
||||||
filetext = textfile.read()
|
filetext = textfile.read()
|
||||||
textfile.close()
|
textfile.close()
|
||||||
matches = re.findall("t=(\d+)", filetext)
|
|
||||||
return int(matches[0][0:-NO_OF_DECIMALS]) + (int(matches[0][-NO_OF_DECIMALS:]) / 1000.0)
|
matches = re.findall("t=(\-?)(\d+)", filetext)
|
||||||
|
sign = -1 if matches[0][0] == '-' else 1
|
||||||
|
whole_reading = matches[0][1]
|
||||||
|
first_part = matches[0][1][0:-NO_OF_DECIMALS]
|
||||||
|
second_part = matches[0][1][-NO_OF_DECIMALS:]
|
||||||
|
first_part = '0' if first_part == '' else first_part
|
||||||
|
|
||||||
|
return (int(first_part) + (int(second_part) / (10.0 ** NO_OF_DECIMALS) )) * sign
|
||||||
|
|
||||||
def read_many_thermo(filenames):
|
def read_many_thermo(filenames):
|
||||||
result = []
|
result = []
|
||||||
|
|||||||
Reference in New Issue
Block a user