SixBytesUnder/custom-motd

Temperatures

j-justice opened this issue · 2 comments

The temps only display in Celcius and not Fahrenheit.

The weather one can be fixed by switching the URL metric from 1 (celcius) to 0 (fahrenheit)

http://rss.accuweather.com/rss/liveweather_rss.asp?**metric=1** &locCode=$weatherCode

I am not sure how to convert the CPU temp in bash properly.

I was able to replace the CPUTEMP code block below from the original:

'CPUTEMP')
   displayMessage 'CPU Temperature....:' "`vcgencmd measure_temp | cut -c "6-20"`"
    ;;

and get it to convert to Fahrenheit with the below code:

 'CPUTEMP')
 
 temp=`/opt/vc/bin/vcgencmd measure_temp`
tmp=${temp:5:4}
u=${temp:5:2}
f=${temp:8:1}
t=$(($u*10+$f))
f=$(($t*9/5+320))
      displayMessage 'CPU Temperature....:'  $(($f/10)).$(($f%10))\'F 
        ;;

Hi
You didn't have to do that :)
If you look above, I've closed this issue with a 85735d9 commit. With it , I've added a new option to change all temperature displays to Fahrenheit.
Just download the latest file and change option from degrees=C to degrees=F That's it :)