carsten_h wrote:
> You can try to call "sudo modprobe i2c-dev" on the shell. Normally there
> should nothing be seen. If there is something missing, I would expect an
> error.
>
> But I found an error I think, the second command should be "sudo python3
> /home/tc/argononed.py". I don't know why I had it working without
> "sudo".
>
> So, if you call this second command also nothing should be visible and
> it should not come back to the prompt. If you press "Control-c" then,
> there should be this message:
> "Exception ignored in sys.unraisablehook: <built-in function
> unraisablehook>
> KeyboardInterrupt" and you should be back at the prompt.
>
> You can also try if the temperature measurement is working by calling:
> "sudo vcgencmd measure_temp"
> You should get back something like: "temp=42.8'C".
>
> You can look if the file argononed.py is existing with "ll", there
> should be this line shown: "-rw-r--r-- 1 tc staff 2288
> Dec 11 12:20 argononed.py".
> And if you call "cat argononed.py" you should see the contents of the
> file like it is shown in the first post here.
>
> That's all I can think of in the moment.
Hi Carsten,
Thanks again. I tried the first four things and here is what I got:
1.) tc@piCoreLMS:~$ sudo modprobe i2c-dev YES, NOTHING SEEN.
2.) tc@piCoreLMS:~$ sudo python3 /home/tc/argononed.py
File "/home/tc/argononed.py", line 102
while True:
^
IndentationError: unexpected indent
3.) tc@piCoreLMS:~$ ^C NOTHING HAPPENED.
4.) tc@piCoreLMS:~$ sudo vcgencmd measure_temp THIS SEEMS FINE.
temp=36.5'C
5.) Then, I typed in cat argonone.py and see this:
tc@piCoreLMS:~$ cat argononed.py
i
#!/usr/bin/python
import smbus
import RPi.GPIO as GPIO
import os
import time
from threading import Thread
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
bus = smbus.SMBus(1)
else:
bus = smbus.SMBus(0)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
shutdown_pin=4
GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def shutdown_check():
while True:
pulsetime = 1
GPIO.wait_for_edge(shutdown_pin, GPIO.RISING)
time.sleep(0.01)
while GPIO.input(shutdown_pin) == GPIO.HIGH:
time.sleep(0.01)
pulsetime += 1
if pulsetime >=2 and pulsetime <=3:
os.system("pcp rb")
elif pulsetime >=4 and pulsetime <=5:
os.system("pcp sd")
def get_fanspeed(tempval, configlist):
for curconfig in configlist:
curpair = curconfig.split("=")
tempcfg = float(curpair[0])
fancfg = int(float(curpair[1]))
if tempval >= tempcfg:
return fancfg
return 0
def load_config(fname):
newconfig = []
try:
with open(fname, "r") as fp:
for curline in fp:
if not curline:
continue
tmpline = curline.strip()
if not tmpline:
continue
if tmpline[0] == "#":
continue
tmppair = tmpline.split("=")
if len(tmppair) != 2:
continue
tempval = 0
fanval = 0
try:
tempval = float(tmppair[0])
if tempval < 0 or tempval >
100:
continue
except:
continue
try:
fanval = int(float(tmppair[1]))
if fanval < 0 or fanval > 100:
continue
except:
continue
newconfig.append(
"{:5.1f}={}".format(tempval,fanval))
if len(newconfig) > 0:
newconfig.sort(reverse=True)
except:
return []
return newconfig
def temp_check():
fanconfig = ["65=100", "60=55", "57=30", "55=10", "30=0"]
tmpconfig = load_config("etc/argononed.conf")
if len(tmpconfig) > 0:
fanconfig = tmpconfig
address=0x1a
prevblock=0
while True:
temp = os.popen("vcgencmd measure_temp").readline()
temp = temp.replace("temp=","")
val = float(temp.replace("'C",""))
block = get_fanspeed(val, fanconfig)
if block < prevblock:
time.sleep(30)
prevblock = block
try:
bus.write_byte(address,block)
except IOError:
temp=""
time.sleep(30)
try:
t1 = Thread(target = shutdown_check)
t2 = Thread(target = temp_check)
t1.start()
t2.start()
except:
t1.stop()
t2.stop()
GPIO.cleanup()
ck=0
while True:
temp = os.popen("vcgencmd measure_temp").readline()
temp = temp.replace("temp=","")
val = float(temp.replace("'C",""))
block = get_fanspeed(val, fanconfig)
if block < prevblock:
time.sleep(30)
prevblock = block
try:
bus.write_byte(address,block)
except IOError:
temp=""
time.sleep(30)
try:
t1 = Thread(target = shutdown_check)
t2 = Thread(target = temp_check)
t1.start()
t2.start()
except:
t1.stop()
t2.stop()
GPIO.cleanup()
- argononed.py 100/100 100%
tc@piCoreLMS:~$
I tried to type in "||" (two vertical bars), but it didn't accept this
command. Maybe it's not supposed to be vertical bars???
tc@piCoreLMS:~$ ||
-sh: syntax error: unexpected "||"
Finally, to check and see if I could change the fan settings, I typed in
"fanconfig", but this is what came back. What am I doing wrong?
tc@piCoreLMS:~$ fanconfig
-sh: fanconfig: not found
So, maybe it looks like things are more o.k. than I thought??
Cheers
Rg
System information
------------------------
Main: RPI4B/PiCorePlayer/LMS> RPI4B/piCoreplayer/Squeezelite > USB>RME
ADI-2 DAC > Benchmark AHB2 > Revel Performa F208 speakers, 2X REL R-305
subs.
Home Theatre: RPI4 B/HifiBerry Dac+ Pro>Pioneer VSX 919 > Energy Take 5
Classic 5.1.
LMS 8.1.0 - 1608700893 on RPI4B with 1tb Samsung T5 SSD.
------------------------------------------------------------------------
rgro's Profile: http://forums.slimdevices.com/member.php?userid=34348
View this thread: http://forums.slimdevices.com/showthread.php?t=113575
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix