Subversion Repositories yaws

Rev

Rev 11 | Rev 17 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 16
Line 1... Line 1...
1
#!/usr/bin/env python3
1
#!/usr/bin/python3
2
# -*- coding: utf-8 -*-
2
# -*- coding: utf-8 -*-
3
#
3
#
4
#  sensors/__init__.py
4
#  sensors/__init__.py
5
#  
5
#  
6
#  Copyright 2020 Ron Wellsted <ron@wellsted.org.uk>
6
#  Copyright 2020 Ron Wellsted <ron@wellsted.org.uk>
Line 19... Line 19...
19
#  along with this program; if not, write to the Free Software
19
#  along with this program; if not, write to the Free Software
20
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
#  MA 02110-1301, USA.
21
#  MA 02110-1301, USA.
22
#
22
#
23
#
23
#
24
import re, smbus
24
import re, smbus, w1thermsensor
-
 
25
from gpiozero import pi_info
25
i2cbus = None
26
i2cbus = None
Line 26... Line 27...
26
 
27
 
Line 27... Line 28...
27
debug = True
28
debug = True
28
 
29
 
29
# find out which revision of RPi we are running on
30
# find out which revision of RPi we are running on
30
info = open('/proc/cpuinfo')
31
#info = open('/proc/cpuinfo')
31
for line in info:
32
#for line in info:
32
    line = line.rstrip()
33
#    line = line.rstrip()
-
 
34
#    if re.search('Revision', line):
33
    if re.search('Revision', line):
35
#        x, x, rev = line.split()
34
        x, x, rev = line.split()
36
rev = pi_info.revision
35
        if rev == '0002':
37
if rev == '0002':
36
            i2cbus = 0
38
    i2cbus = 0
Line 37... Line 39...
37
        else:
39
else:
38
            i2cbus = 1
40
    i2cbus = 1
39
 
41