slitaz-arm rev 173

PiLeds: add support for PiClass example code and show currrent CPU freq in CGI/adm
author Christophe Lincoln <pankso@slitaz.org>
date Wed May 07 11:30:16 2014 +0200 (2014-05-07)
parents af4b31a2d8f2
children 4b98ccd8fa58
files rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi rpi/pileds
line diff
     1.1 --- a/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi	Sun May 04 22:25:37 2014 +0200
     1.2 +++ b/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi	Wed May 07 11:30:16 2014 +0200
     1.3 @@ -107,10 +107,16 @@
     1.4  		html_footer && exit 0 ;;
     1.5  	
     1.6  	*\ oclock\ *)
     1.7 +		cur_freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
     1.8 +		cur=$(($cur_freq / 1000))
     1.9  		html_header "Overclocking"
    1.10  		cat << EOT
    1.11  <h1>RPi Overclocking</h1>
    1.12  
    1.13 +<p>
    1.14 +	Current CPU freq scaling value: $cur MHz
    1.15 +</p>
    1.16 +
    1.17  <pre>
    1.18  $(tazberry rpi_oclock)
    1.19  </pre>
     2.1 --- a/rpi/pileds	Sun May 04 22:25:37 2014 +0200
     2.2 +++ b/rpi/pileds	Wed May 07 11:30:16 2014 +0200
     2.3 @@ -9,13 +9,19 @@
     2.4  usage() {
     2.5  	cat << EOT
     2.6  
     2.7 -$(boldify "Usage:") $(basename $0) [command]
     2.8 +$(boldify "Usage:") $(basename $0) [command] [--option]
     2.9  
    2.10  $(boldify "Commands:")
    2.11 -  act          Turn on/off the on board ACT green led
    2.12 -  7-clock      Adafruit 7-segment LED Backpack clock example
    2.13 -  8x8          Adafruit 8x8 LED Matrix Backpack example
    2.14 -  ada-clean    Clean: Adafruit 7-segment or 8x8 Matrix  
    2.15 +  act          $(gettext "Turn on/off the on board ACT green led")
    2.16 +  7-clock      $(gettext "Adafruit 7-segment LED Backpack clock example")
    2.17 +  8x8          $(gettext "Adafruit 8x8 LED Matrix Backpack example")
    2.18 +  ada-clean    $(gettext "Clean: Adafruit 7-segment or 8x8 Matrix")
    2.19 + 
    2.20 +$(boldify "8x8 Options:")
    2.21 +  --test       $(gettext "Test the 8x8 LED Matrix")
    2.22 +  --boat       $(gettext "Draw a tiny boat")
    2.23 +  --smile      $(gettext "Draw a smiley :-)")
    2.24 +  --ovni       $(gettext "Draw an OVNI")
    2.25  
    2.26  EOT
    2.27  }
    2.28 @@ -60,13 +66,19 @@
    2.29  		fi ;;
    2.30  	
    2.31  	8x8)
    2.32 -		scripts="/usr/share/adafruit/LEDBackpack"
    2.33 +		if [ "$2" == "--test" ]; then
    2.34 +			script="/usr/share/adafruit/LEDBackpack/ex_8x8_pixels.py"
    2.35 +			check_packages "python-rpi-adafruit"
    2.36 +		else
    2.37 +			script_name="${$2#--}.py"
    2.38 +			script="/usr/share/piclass/leds/8x8/$script_name"
    2.39 +			check_packages "python-rpi-adafruit piclass-code-examples"
    2.40 +		fi
    2.41  		load_modules
    2.42 -		check_packages "python-rpi-adafruit"
    2.43 -		if [ -f "${scripts}/ex_7segment_clock.py" ]; then
    2.44 -			python ${scripts}/ex_8x8_pixels.py
    2.45 +		if [ -f "${script}" ]; then
    2.46 +			python ${script}
    2.47  		else
    2.48 -			gettext "Missing:"; echo " ${scripts}/ex_8x8_pixels.py"
    2.49 +			gettext "Missing script:"; echo " ${script}"
    2.50  		fi ;;
    2.51  		
    2.52  	ada-clean)