carsten_h wrote: 
> 
> I also don't know python, but I would make it the following way:
> > 
Code:
--------------------
  >   >         while True:
  >             temp = os.popen("vcgencmd measure_temp").readline()
  >             temp = temp.replace("temp=","")
  >             val = float(temp.replace("'C",""))
  >             fanconfig = load_config("/home/tc/argononed.conf")
  >             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)
  > 
--------------------
> > 
> 
> But I don't know what happens to the performance then, because every
> 30 seconds the file has to be opened, read and closed.
> You can try it. :-)

I'm not so sure - I don't know what 'block' looks like (coming back from
'get_fanspeed'), but if fanconfig changes then I think the link between
block and prevblock will be broken.  Probably not important for one
iteration of the loop, but I'd want to look more closely at what
happens.

As for the performance penalty for reading the file every 30 seconds, I
think it will be negligible.  I have a similar shell script (to turn my
own fan on and off via GPIO).  That reads an external file quite happily
every 5 seconds with no apparent ill-effects!


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=113575

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to