diff --git a/code/shell/config_for_pico.sh b/code/shell/config_for_pico.sh index 0b17fb2..73ab4a3 100755 --- a/code/shell/config_for_pico.sh +++ b/code/shell/config_for_pico.sh @@ -18,24 +18,22 @@ pip install psutil echo '--- pip install xmltodict' pip install xmltodict -echo '--- save and edit cmdline.txt' -cp /boot/cmdline.txt /boot/cmdline.txt.save -sed -i 's| console=serial0,115200 console=tty1||' /boot/cmdline.txt - -echo '--- save and edit config.txt' -cp /boot/config.txt /boot/config.txt.save -sed -i 's|#dtparam=i2c_arm=on|dtparam=i2c_arm=on|' /boot/config.txt - +echo '--- installing & enabling daemon' +cd PiModules/code/python/package +python setup.py install +cd ../upspico/picofssd +python setup.py install +systemctl enable picofssd.service echo '--- adding line to config.txt' -echo -e "\n\ndtparam=pi3-disable-bt\n\n" >> /boot/config.txt +echo -e "\n\ndtoverlay=i2c-rtc,ds1307\n\n" >> /boot/config.txt +echo -e "\n\nenable_uart=1\n\n" >> /boot/config.txt echo '--- adding lines to /etc/modules' -echo -e "\n\ni2c-bcm2708\ni2c-dev\n\n" >> /etc/modules +echo -e "\n\ni2c-bcm2708\ni2c-dev\rtc-ds1307\n\n" >> /etc/modules -echo '--- disabling hciuart' -systemctl disable hciuart +echo '--- removing fake-hwclock' +apt-get -y remove fake-hwclock && sudo update-rc.d -f fake-hwclock remove echo '--- all done' exit 0 - diff --git a/code/shell/post_firmware_update.sh b/code/shell/post_firmware_update.sh new file mode 100644 index 0000000..a80e8f0 --- /dev/null +++ b/code/shell/post_firmware_update.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ `whoami` != 'root' ]; then + echo 'Must be run as root' + exit 1 +fi + +set -e + +echo '--- save and edit cmdline.txt' +rm /boot/cmdline.txt +cp /boot/cmdline.txt.save /boot/cmdline.txt + +echo '--- adding line to config.txt' +sed -i 's|dtparam=pi3-disable-bt|#dtparam=pi3-disable-bt|' /boot/config.txt + +echo '--- enabling hciuart' +systemctl enable hciuart + +echo '--- enabling serial' +systemctl start serial-getty@ttyAMA0.service +systemctl enable serial-getty@ttyAMA0.service +systemctl start serial-getty@ttyS0.service +systemctl enable serial-getty@ttyS0.service + +echo '--- all done' +exit 0 \ No newline at end of file diff --git a/code/shell/pre_firmware_update.sh b/code/shell/pre_firmware_update.sh new file mode 100644 index 0000000..e2fe0e0 --- /dev/null +++ b/code/shell/pre_firmware_update.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ `whoami` != 'root' ]; then + echo 'Must be run as root' + exit 1 +fi + +set -e + +echo '--- save and edit cmdline.txt' +cp /boot/cmdline.txt /boot/cmdline.txt.save +sed -i 's| console=ttyAMA0,115200||' /boot/cmdline.txt + +echo '--- adding line to config.txt' +echo -e "\n\ndtparam=pi3-disable-bt\n\n" >> /boot/config.txt + +echo '--- disabling hciuart' +systemctl disable hciuart + +echo '--- disabling serial' +systemctl stop serial-getty@ttyAMA0.service +systemctl disable serial-getty@ttyAMA0.service +systemctl stop serial-getty@ttyS0.service +systemctl disable serial-getty@ttyS0.service + +echo '--- all done' +exit 0 diff --git a/pico_status/pico_status_hv3.0.py b/pico_status/pico_status_hv3.0.py index 9e7be5d..4abfba0 100644 --- a/pico_status/pico_status_hv3.0.py +++ b/pico_status/pico_status_hv3.0.py @@ -155,8 +155,30 @@ def fan_state(): def fan_speed(): time.sleep(0.1) data = i2c.read_word_data(0x6b, 0x12) - data = format(data,"02x") - return (float(data) * 10) + if (data == 0x00): + return "OFF" + elif (data == 0x0a): + return "10%" + elif (data == 0x14): + return "20%" + elif (data == 0x1e): + return "30%" + elif (data == 0x28): + return "40%" + elif (data == 0x32): + return "50%" + elif (data == 0x3c): + return "60%" + elif (data == 0x46): + return "70%" + elif (data == 0x50): + return "80%" + elif (data == 0x5a): + return "90%" + elif (data == 0x64): + return "100%" + else: + return "ERROR" def r232_state(): time.sleep(0.1) @@ -210,9 +232,9 @@ def r232_state(): print " " print " ","PIco FAN Mode.........:",fan_mode() print " ","PIco FAN State........:",fan_state() -print " ","PIco FAN Speed........:",fan_speed(),"RPM" +print " ","PIco FAN Speed........:",fan_speed() print " " print "***********************************" print " Powered by PiCo " print "***********************************" -print " " \ No newline at end of file +print " "