carsten_h wrote: 
> This is the part to create the daemon for temperature checking (it is
> running as a service later:
> > 
Code:
--------------------
  >   > echo 'def temp_check():' >> $powerbuttonscript
  > echo '      fanconfig = ["65=100", "60=55", "55=10"]' >> $powerbuttonscript
  > echo '      tmpconfig = load_config("'$daemonconfigfile'")' >> 
$powerbuttonscript
  > echo '      if len(tmpconfig) > 0:' >> $powerbuttonscript
  > echo '              fanconfig = tmpconfig' >> $powerbuttonscript
  > echo '      address=0x1a' >> $powerbuttonscript
  > echo '      prevblock=0' >> $powerbuttonscript
  > echo '      while True:' >> $powerbuttonscript
  > echo '              temp = os.popen("vcgencmd measure_temp").readline()' >> 
$powerbuttonscript
  > echo '              temp = temp.replace("temp=","")' >> $powerbuttonscript
  > echo '              val = float(temp.replace("'"'"'C",""))' >> 
$powerbuttonscript
  > echo '              block = get_fanspeed(val, fanconfig)' >> 
$powerbuttonscript
  > echo '              if block < prevblock:' >> $powerbuttonscript
  > echo '                      time.sleep(30)' >> $powerbuttonscript
  > echo '              prevblock = block' >> $powerbuttonscript
  > echo '              try:' >> $powerbuttonscript
  > echo '                      bus.write_byte(address,block)' >> 
$powerbuttonscript
  > echo '              except IOError:' >> $powerbuttonscript
  > echo '                      temp=""' >> $powerbuttonscript
  > echo '              time.sleep(30)' >> $powerbuttonscript
  > 
--------------------
> > 
> 
> They are reading the temperature with "vcgencmd measure_temp" and if
> it reaches the next step from the config they call this:
> > 
Code:
--------------------
  >   > bus.write_byte(address,block)
--------------------
> > 
> where address is 0x1a and block is the fanspeed from config.
> 
> I don't know what this bus.write_byte is doing. Maybe it is enough to
> write this a single time to have the fan running always at the same
> speed?

Looks like the you need python, smbus, and rpi-vc. As dependencies.  On
the surface, the fan looks like itÂ’s I2c controlled....  They have 3 fan
speeds.



piCorePlayer a small player for the Raspberry Pi in RAM. 
Homepage: https://www.picoreplayer.org

Please 'donate'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=U7JHY5WYHCNRU&lc=GB&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
if you like the piCorePlayer
------------------------------------------------------------------------
paul-'s Profile: http://forums.slimdevices.com/member.php?userid=58858
View this thread: http://forums.slimdevices.com/showthread.php?t=110727

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to