-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathme.sh
executable file
·135 lines (122 loc) · 3.1 KB
/
me.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
#set -x
#for debug
function __echo () {
echo $1
echo $1 >> $DrawFile
}
function _echo () {
echo $1 >> $DrawFile
}
DrawFile="./draw.txt"
if [ -f ${DrawFile} ]; then
rm $DrawFile
fi
#Inquiry tft information
screen_width=`./draw width`
screen_height=`./draw height`
driver_name=`./draw driver`
echo -n "Your TFT is "
echo -n ${driver_name}
echo -n " "
echo -n ${screen_width}
echo -n "x"
echo ${screen_height}
#Calculate Y position
xorg=10
ycenter=$((screen_height/2))
yorg=$((ycenter-130))
#echo $ycenter
#echo $yorg
if [ $yorg -lt 0 ]; then
yorg=0
fi
#Black(0x000000)
_echo "FillScrren,0x0000"
_echo "SetFontDirection,3"
#White(0xffffff)
color=`./rgb2color 0xffffff`
y1=$yorg
y2=$((y1+235))
x1=$xorg
x2=$((x1+30))
_echo "DrawRoundRect,${x1},${y1},${x2},${y2},10,${color}"
xs=$((xorg+30))
ys=$((yorg+10))
_echo "DrawUTF8String,G24,${xs},${ys},System Information,${color}"
#Cyan(0x00ffff)
color=`./rgb2color 0x00ffff`
x1=$((xorg+44))
x2=$((x1+10))
y1=$((yorg+10))
y2=$((y1+10))
xs=$((xs+30))
ys=$((yorg+30))
_echo "DrawFillRect,${x1},${y1},${x2},${y2},${color}"
#_echo "SetFontUnderLine,${color}"
_echo "DrawUTF8String,G24,${xs},${ys},wlan0 IP Address,${color}"
#_echo "UnsetFontUnderLine"
IpAddr=`ifconfig wlan0 | grep "inet " | awk {'print $2'}`
xs=$((xs+20))
_echo "SetFontUnderLine,${color}"
if [ -n "$IpAddr" ]; then
_echo "DrawUTF8String,G24,${xs},${ys},${IpAddr},${color}"
else
_echo "DrawUTF8String,G24,${xs},${ys},<NONE>,${color}"
fi
_echo "UnsetFontUnderLine"
#Magenta(0xff0090)
color=`./rgb2color 0xff0090`
x1=$((x1+50))
x2=$((x1+10))
xs=$((xs+30))
_echo "DrawFillRect,${x1},${y1},${x2},${y2},${color}"
_echo "DrawUTF8String,G24,${xs},${ys},eth0 IP Address,${color}"
IpAddr=`ifconfig eth0 | grep "inet " | awk {'print $2'}`
xs=$((xs+20))
_echo "SetFontUnderLine,${color}"
if [ -n "$IpAddr" ]; then
_echo "DrawUTF8String,G24,${xs},${ys},${IpAddr},${color}"
else
_echo "DrawUTF8String,G24,${xs},${ys},<NONE>,${color}"
fi
_echo "UnsetFontUnderLine"
#Orange(0xff5c00)
color=`./rgb2color 0xff5c00`
x1=$((x1+50))
x2=$((x1+10))
xs=$((xs+30))
_echo "DrawFillRect,${x1},${y1},${x2},${y2},${color}"
_echo "DrawUTF8String,G24,${xs},${ys},kernel release,${color}"
Release=`uname -r`
xs=$((xs+20))
_echo "SetFontUnderLine,${color}"
_echo "DrawUTF8String,G24,${xs},${ys},${Release},${color}"
_echo "UnsetFontUnderLine"
#Lime Green(0x00ff00)
color=`./rgb2color 0x00ff00`
x1=$((x1+50))
x2=$((x1+10))
xs=$((xs+30))
_echo "DrawFillRect,${x1},${y1},${x2},${y2},${color}"
_echo "DrawUTF8String,G24,${xs},${ys},CPU Temp.,${color}"
temp=`vcgencmd measure_temp | cut -d= -f2`
xs=$((xs+20))
_echo "SetFontUnderLine,${color}"
_echo "DrawUTF8String,G24,${xs},${ys},${temp},${color}"
_echo "UnsetFontUnderLine"
if [ $screen_width -gt 240 ]; then
#Blue(0x0000ff)
color=`./rgb2color 0x0000ff`
x1=$((x1+50))
x2=$((x1+10))
xs=$((xs+30))
_echo "DrawFillRect,${x1},${y1},${x2},${y2},${color}"
_echo "DrawUTF8String,G24,${xs},${ys},DISK Usage,${color}"
temp=`df | grep root | awk {'print $5'}`
xs=$((xs+20))
_echo "SetFontUnderLine,${color}"
_echo "DrawUTF8String,G24,${xs},${ys},${temp},${color}"
_echo "UnsetFontUnderLine"
fi
./draw $DrawFile > /dev/null