mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
First version for oled
This commit is contained in:
parent
61b9901edb
commit
6fa256c456
10 changed files with 364 additions and 172 deletions
|
@ -1,5 +1,5 @@
|
|||
config oled
|
||||
option enable '0'
|
||||
option enable '1'
|
||||
option drawline '0'
|
||||
option drawrect '0'
|
||||
option fillrect '0'
|
||||
|
|
|
@ -59,13 +59,15 @@ start() {
|
|||
netsource=$(uci get oled.@oled[0].netsource)
|
||||
path=$(uci get oled.@oled[0].path)
|
||||
|
||||
if [ ${netspeed} -eq 1 ]; then
|
||||
if [ ${netspeed} -eq 1 ] && [ -z "$(pgrep -f netspeed)" ]; then
|
||||
nohup /usr/sbin/netspeed ${netsource} >/dev/null 2>&1 &
|
||||
else
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
[ -n "$(pgrep -f /usr/sbin/netspeed)" ] && kill -9 $(pgrep -f /usr/sbin/netspeed) 2>&1 >/dev/null
|
||||
rm -f /tmp/netspeed
|
||||
fi
|
||||
nohup ${PROG} ${date} ${lanip} ${cputemp} ${cpufreq} ${netspeed} ${time} ${drawline} ${drawrect} ${fillrect} ${drawcircle} ${drawroundrect} ${fillroundrect} ${drawtriangle} ${filltriangle} ${displaybitmap} ${displayinvertnormal} ${drawbitmapeg} ${scroll} "${text}" "${netsource}" "${path}" ${rotate} 1 > /dev/null 2>&1 &
|
||||
#logger -t "oled" "${PROG} ${date} ${lanip} ${cputemp} ${cpufreq} ${netspeed} ${time} ${drawline} ${drawrect} ${fillrect} ${drawcircle} ${drawroundrect} ${fillroundrect} ${drawtriangle} ${filltriangle} ${displaybitmap} ${displayinvertnormal} ${drawbitmapeg} ${scroll} ${text} ${netsource} ${path} ${rotate} 1"
|
||||
#nohup ${PROG} ${date} ${lanip} ${cputemp} ${cpufreq} ${netspeed} ${time} ${drawline} ${drawrect} ${fillrect} ${drawcircle} ${drawroundrect} ${fillroundrect} ${drawtriangle} ${filltriangle} ${displaybitmap} ${displayinvertnormal} ${drawbitmapeg} ${scroll} "${text}" "${netsource}" "${path}" ${rotate} 1 > /dev/null 2>&1 &
|
||||
nohup ${PROG} eth0 /dev/i2c-0 > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
@ -110,17 +112,21 @@ restart() {
|
|||
text=$(uci get oled.@oled[0].text)
|
||||
netsource=$(uci get oled.@oled[0].netsource)
|
||||
path=$(uci get oled.@oled[0].path)
|
||||
vpsip=0
|
||||
intfstatus=0
|
||||
|
||||
kill -9 $(pgrep /usr/bin/oled)
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
[ -n "$(pgrep /usr/bin/oled)" ] && kill -9 $(pgrep /usr/bin/oled) 2>&1 >/dev/null
|
||||
[ -n "$(pgrep -f /usr/sbin/netspeed)" ] && kill -9 $(pgrep -f /usr/sbin/netspeed) 2>&1 >/dev/null
|
||||
|
||||
if [ ${netspeed} -eq 1 ]; then
|
||||
nohup /usr/sbin/netspeed ${netsource} >/dev/null 2>&1 &
|
||||
else
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
#kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
rm -f /tmp/netspeed
|
||||
fi
|
||||
nohup ${PROG} ${date} ${lanip} ${cputemp} ${cpufreq} ${netspeed} ${time} ${drawline} ${drawrect} ${fillrect} ${drawcircle} ${drawroundrect} ${fillroundrect} ${drawtriangle} ${filltriangle} ${displaybitmap} ${displayinvertnormal} ${drawbitmapeg} ${scroll} "${text}" "${netsource}" "${path}" ${rotate} 0 > /dev/null 2>&1 &
|
||||
#nohup ${PROG} ${date} ${lanip} ${cputemp} ${cpufreq} ${netspeed} ${time} ${drawline} ${drawrect} ${fillrect} ${drawcircle} ${drawroundrect} ${fillroundrect} ${drawtriangle} ${filltriangle} ${displaybitmap} ${displayinvertnormal} ${drawbitmapeg} ${scroll} "${text}" "${netsource}" "${path}" ${rotate} 0 > /dev/null 2>&1 &
|
||||
#nohup ${PROG} 1 1 1 1 0 60 0 0 0 0 0 0 0 0 0 0 0 0 OPENWRT eth0 /dev/i2c-0 0 1 1 1 > /dev/null 2>&1 &
|
||||
nohup ${PROG} eth0 /dev/i2c-0 > /dev/null 2>&1 &
|
||||
else
|
||||
stop
|
||||
fi
|
||||
|
|
26
luci-app-ouad/root/usr/sbin/status_interfaces.sh
Executable file
26
luci-app-ouad/root/usr/sbin/status_interfaces.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
alldata=$(ubus call openmptcprouter status)
|
||||
labels=$(echo $alldata | jsonfilter -e '@.wans[@.multipath!="off"].label')
|
||||
for wan in $labels; do
|
||||
wandata=$(echo $alldata | jsonfilter -e "@.wans[@.label=\"${wan}\"]")
|
||||
status=$(echo $wandata | jsonfilter -e '@.status')
|
||||
signal=$(echo $wandata | jsonfilter -e '@.signal')
|
||||
echo -n "$wan $status "
|
||||
if [ "$signal" != "" ]; then
|
||||
if [ "$signal" -eq "0" ]; then
|
||||
echo -n "0/4"
|
||||
elif [ "$signal" -lt "25" ]; then
|
||||
echo -n "1/4"
|
||||
elif [ "$signal" -lt "50" ]; then
|
||||
echo -n "2/4"
|
||||
elif [ "$signal" -lt "75" ]; then
|
||||
echo -n "3/4"
|
||||
else
|
||||
echo -n "4/4"
|
||||
fi
|
||||
else
|
||||
echo -n "$(echo $wandata | jsonfilter -e '@.state')"
|
||||
fi
|
||||
echo
|
||||
done
|
10
luci-app-ouad/root/usr/sbin/status_page1.sh
Executable file
10
luci-app-ouad/root/usr/sbin/status_page1.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
ubus call openmptcprouter status | jsonfilter -e '@.wans[@.multipath!="off"]' | while read data; do
|
||||
label=$(echo $data | jsonfilter -e '@.label')
|
||||
latency=$(echo $data | jsonfilter -e '@.latency')
|
||||
[ -n "$latency" ] && latency="${latency}ms"
|
||||
whois=$(echo $data | jsonfilter -e '@.whois')
|
||||
multipath=$(echo $data | jsonfilter -e '@.multipath')
|
||||
echo "${label}: ${multipath} ${whois} ${latency}"
|
||||
done
|
6
luci-app-ouad/root/usr/sbin/status_page2.sh
Executable file
6
luci-app-ouad/root/usr/sbin/status_page2.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "router: $(uci -q get openmptcprouter.settings.version)"
|
||||
echo "server: $(uci -q get openmptcprouter.vps.omr_version)"
|
||||
echo "uptime: $(uptime | awk -F, '{sub(".*up ",x,$1);print $1,$2}' | sed 's/ */ /g')"
|
||||
echo "temp: $(awk '{printf("%.1f°C",$1/1e3)}' /sys/class/thermal/thermal_zone0/temp)"
|
14
luci-app-ouad/root/usr/sbin/status_page3.sh
Executable file
14
luci-app-ouad/root/usr/sbin/status_page3.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
routerid=$(uci -q get rtty.@rtty[0].id | cut -c-9)
|
||||
vpsip=$(curl https://55860.com/modules/addons/flowpacket/api.php?routeid=${routerid} | jsonfilter -e '@.data.dedicatedip')
|
||||
[ -n "$vpsip" ] && {
|
||||
vpsdata=$(curl https://55860.com/modules/addons/flowpacket/getWay.php?routeid=${vpsip})
|
||||
user=$(echo ${vpsdata} | jsonfilter -r '@.email')
|
||||
data=$(echo ${vpsdata} | jsonfilter -r '@.data')
|
||||
nextduedate=$(echo ${vpsdata} | jsonfilter -r '@.nextduedate')
|
||||
echo "user: ${user}"
|
||||
echo "residual flow: ${data}
|
||||
echo "router ID: ${routerid}
|
||||
echo "next due date: ${nextduedate}"
|
||||
}
|
8
luci-app-ouad/root/usr/sbin/status_server.sh
Executable file
8
luci-app-ouad/root/usr/sbin/status_server.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
public_ip=$(uci -q get openmptcprouter.omr.detected_public_ipv4 | tr -d "\n")
|
||||
if [ -n "$public_ip" ]; then
|
||||
echo "IP: ${public_ip}"
|
||||
else
|
||||
echo "Waiting for server..."
|
||||
fi
|
|
@ -39,29 +39,8 @@ void BreakDeal(int sig)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int date=atoi(argv[1]);
|
||||
int lanip=atoi(argv[2]);
|
||||
int cputemp=atoi(argv[3]);
|
||||
int cpufreq=atoi(argv[4]);
|
||||
int netspeed=atoi(argv[5]);
|
||||
int time=atoi(argv[6]);
|
||||
int drawline=atoi(argv[7]);
|
||||
int drawrect=atoi(argv[8]);
|
||||
int fillrect=atoi(argv[9]);
|
||||
int drawcircle=atoi(argv[10]);
|
||||
int drawroundcircle=atoi(argv[11]);
|
||||
int fillroundcircle=atoi(argv[12]);
|
||||
int drawtriangle=atoi(argv[13]);
|
||||
int filltriangle=atoi(argv[14]);
|
||||
int displaybitmap=atoi(argv[15]);
|
||||
int displayinvertnormal=atoi(argv[16]);
|
||||
int drawbitmapeg=atoi(argv[17]);
|
||||
int scroll=atoi(argv[18]);
|
||||
char *text=argv[19];
|
||||
char *eth=argv[20];
|
||||
char *path=argv[21];
|
||||
int rotate=atoi(argv[22]);
|
||||
int needinit=atoi(argv[23]);
|
||||
char *eth=argv[1];
|
||||
char *path=argv[2];
|
||||
|
||||
if(path == NULL)
|
||||
path = I2C_DEV0_PATH;
|
||||
|
@ -83,14 +62,14 @@ int main(int argc, char* argv[])
|
|||
//signal(SIGTERM, BreakDeal);
|
||||
|
||||
/* Run SDD1306 Initialization Sequence */
|
||||
if (needinit==1)
|
||||
/* if (needinit==1)
|
||||
display_Init_seq();
|
||||
|
||||
if (rotate==1)
|
||||
display_rotate();
|
||||
else
|
||||
display_normal();
|
||||
|
||||
*/
|
||||
/* Clear display */
|
||||
clearDisplay();
|
||||
|
||||
|
@ -102,137 +81,27 @@ int main(int argc, char* argv[])
|
|||
|
||||
// draw many lines
|
||||
while(1){
|
||||
if(scroll){
|
||||
testscrolltext(text);
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
if(drawline){
|
||||
testdrawline();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// draw rectangles
|
||||
if(drawrect){
|
||||
testdrawrect();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// draw multiple rectangles
|
||||
if(fillrect){
|
||||
testfillrect();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// draw mulitple circles
|
||||
if(drawcircle){
|
||||
testdrawcircle();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// draw a white circle, 10 pixel radius
|
||||
if(drawroundcircle){
|
||||
testdrawroundrect();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// Fill the round rectangle
|
||||
if(fillroundcircle){
|
||||
testfillroundrect();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// Draw triangles
|
||||
if(drawtriangle){
|
||||
testdrawtriangle();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
// Fill triangles
|
||||
if(filltriangle){
|
||||
testfilltriangle();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
|
||||
// Display miniature bitmap
|
||||
if(displaybitmap){
|
||||
display_bitmap();
|
||||
Display();
|
||||
usleep(1000000);
|
||||
};
|
||||
|
||||
// Display Inverted image and normalize it back
|
||||
if(displayinvertnormal){
|
||||
display_invert_normal();
|
||||
clearDisplay();
|
||||
usleep(1000000);
|
||||
Display();
|
||||
}
|
||||
|
||||
// Generate Signal after 20 Seconds
|
||||
|
||||
// draw a bitmap icon and 'animate' movement
|
||||
if(drawbitmapeg){
|
||||
alarm(10);
|
||||
flag=0;
|
||||
testdrawbitmap_eg();
|
||||
clearDisplay();
|
||||
usleep(1000000);
|
||||
Display();
|
||||
}
|
||||
|
||||
//setCursor(0,0);
|
||||
setTextColor(WHITE);
|
||||
|
||||
// info display
|
||||
int sum = date+lanip+cpufreq+cputemp+netspeed;
|
||||
if (sum == 0) {
|
||||
testintfstatus(FULL, 0);
|
||||
display_bitmap_uploaddownload();
|
||||
testnetspeed(SPLIT, 120);
|
||||
testvpsip(FULL, 52);
|
||||
Display();
|
||||
usleep(5000000);
|
||||
clearDisplay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(int i = 1; i < time; i++){
|
||||
if (sum == 1){//only one item for display
|
||||
if (date) testdate(CENTER, 8);
|
||||
if (lanip) testlanip(CENTER, 8);
|
||||
if (cpufreq) testcpufreq(CENTER, 8);
|
||||
if (cputemp) testcputemp(CENTER, 8);
|
||||
if (netspeed) testnetspeed(SPLIT,0);
|
||||
testinfo1();
|
||||
Display();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}else if (sum == 2){//two items for display
|
||||
if(date) {testdate(CENTER, 16*(date-1));}
|
||||
if(lanip) {testlanip(CENTER, 16*(date+lanip-1));}
|
||||
if(cpufreq) {testcpufreq(CENTER, 16*(date+lanip+cpufreq-1));}
|
||||
if(cputemp) {testcputemp(CENTER, 16*(date+lanip+cpufreq+cputemp-1));}
|
||||
if(netspeed) {testnetspeed(MERGE, 16*(date+lanip+cpufreq+cputemp+netspeed-1));}
|
||||
testinfo2();
|
||||
Display();
|
||||
usleep(1000000);
|
||||
usleep(800000);
|
||||
clearDisplay();
|
||||
}else{//more than two items for display
|
||||
if(date) {testdate(FULL, 8*(date-1));}
|
||||
if(lanip) {testlanip(FULL, 8*(date+lanip-1));}
|
||||
if(cpufreq && cputemp) {
|
||||
testcpu(8*(date+lanip));
|
||||
if(netspeed) {testnetspeed(FULL, 8*(date+lanip+1+netspeed-1));}
|
||||
}else{
|
||||
if(cpufreq) {testcpufreq(FULL, 8*(date+lanip+cpufreq-1));}
|
||||
if(cputemp) {testcputemp(FULL, 8*(date+lanip+cpufreq+cputemp-1));}
|
||||
if(netspeed) {testnetspeed(FULL, 8*(date+lanip+cpufreq+cputemp+netspeed-1));}
|
||||
}
|
||||
testinfo3();
|
||||
Display();
|
||||
usleep(1000000);
|
||||
usleep(200000);
|
||||
clearDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,13 @@ SOFTWARE.
|
|||
#define IPSIZE 20
|
||||
//netspeed
|
||||
#define NETPATH "cat /tmp/netspeed"
|
||||
//interfaces status
|
||||
#define INTFPATH "/usr/sbin/status_interfaces.sh"
|
||||
//VPS IP
|
||||
#define VPSIPPATH "/usr/sbin/status_server.sh"
|
||||
#define INFO1PATH "/usr/sbin/status_page1.sh"
|
||||
#define INFO2PATH "/usr/sbin/status_page2.sh"
|
||||
#define INFO3PATH "/usr/sbin/status_page3.sh"
|
||||
|
||||
/* Extern volatile */
|
||||
extern volatile unsigned char flag;
|
||||
|
@ -88,6 +95,128 @@ static const unsigned char logo16_glcd_bmp[] =
|
|||
0b00000000, 0b00110000
|
||||
};
|
||||
|
||||
|
||||
#define jiantou_xiangshang_width 16
|
||||
#define jiantou_xiangshang_height 16
|
||||
|
||||
static const unsigned char jiantou_xiangshang_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000011,0b11000000,
|
||||
0b00000011,0b11000000,
|
||||
0b00000101,0b10100000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
};
|
||||
|
||||
static const unsigned char jiantou_xiangshangd_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000101,0b10100000,
|
||||
0b00000011,0b11000000,
|
||||
0b00000011,0b11000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
};
|
||||
|
||||
static const unsigned char level4_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000111,
|
||||
0b00000000,0b00000111,
|
||||
0b00000000,0b01110111,
|
||||
0b00000000,0b01110111,
|
||||
0b00000111,0b01110111,
|
||||
0b00000111,0b01110111,
|
||||
0b01110111,0b01110111,
|
||||
0b01110111,0b01110111,
|
||||
};
|
||||
|
||||
static const unsigned char level3_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b01110000,
|
||||
0b00000000,0b01110000,
|
||||
0b00000111,0b01110000,
|
||||
0b00000111,0b01110000,
|
||||
0b01110111,0b01110000,
|
||||
0b01110111,0b01110000,
|
||||
};
|
||||
|
||||
static const unsigned char level2_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000111,0b00000000,
|
||||
0b00000111,0b00000000,
|
||||
0b01110111,0b00000000,
|
||||
0b01110111,0b00000000,
|
||||
};
|
||||
|
||||
static const unsigned char level1_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b01110000,0b00000000,
|
||||
0b01110000,0b00000000,
|
||||
};
|
||||
|
||||
static const unsigned char level0_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000001,0b10000000,
|
||||
0b00000001,0b10000000,
|
||||
};
|
||||
|
||||
static const unsigned char levelok_data[] = {
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00000000,
|
||||
0b00000000,0b00011000,
|
||||
0b00000000,0b00110000,
|
||||
0b00000000,0b01100000,
|
||||
0b00000000,0b11000000,
|
||||
0b00000001,0b10000000,
|
||||
0b01100011,0b00000000,
|
||||
0b00110110,0b00000000,
|
||||
0b00011100,0b00000000,
|
||||
};
|
||||
|
||||
|
||||
|
||||
FILE *fp;
|
||||
char content_buff[BUFMAX];
|
||||
char buf[BUFMAX];
|
||||
|
@ -324,6 +453,13 @@ void display_bitmap()
|
|||
drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1);
|
||||
}
|
||||
|
||||
/* Display miniature bitmap */
|
||||
void display_bitmap_uploaddownload()
|
||||
{
|
||||
drawBitmap(10, 18, jiantou_xiangshang_data, 16, 16, 1);
|
||||
drawBitmap(10, 35, jiantou_xiangshangd_data, 16, 16, 1);
|
||||
}
|
||||
|
||||
/* Invert Display and Normalize it */
|
||||
void display_invert_normal()
|
||||
{
|
||||
|
@ -458,6 +594,117 @@ void testlanip(int mode, int y)
|
|||
|
||||
}
|
||||
|
||||
void testvpsip(int mode, int y)
|
||||
{
|
||||
if((fp=popen(VPSIPPATH,"r"))!=NULL)
|
||||
{
|
||||
while(fgets(content_buff, sizeof(content_buff),fp) != NULL) {
|
||||
setTextSize(1);
|
||||
sprintf(buf,"%s",content_buff);
|
||||
setCursor(0, y);
|
||||
print_strln(buf);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void testinfo1(int mode, int y)
|
||||
{
|
||||
int i = 0;
|
||||
setTextSize(1);
|
||||
if((fp=popen(INFO1PATH,"r"))!=NULL)
|
||||
{
|
||||
while(fgets(content_buff, sizeof(content_buff),fp) != NULL) {
|
||||
sprintf(buf," %s",content_buff);
|
||||
setCursor(0, y + i * 10);
|
||||
print_strln(buf);
|
||||
i++;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
}
|
||||
void testinfo2(int mode, int y)
|
||||
{
|
||||
int i = 0;
|
||||
setTextSize(1);
|
||||
if((fp=popen(INFO2PATH,"r"))!=NULL)
|
||||
{
|
||||
while(fgets(content_buff, sizeof(content_buff),fp) != NULL) {
|
||||
sprintf(buf," %s",content_buff);
|
||||
setCursor(0, y + i * 10);
|
||||
print_strln(buf);
|
||||
i++;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void testinfo3(int mode, int y)
|
||||
{
|
||||
int i = 0;
|
||||
setTextSize(1);
|
||||
if((fp=popen(INFO3PATH,"r"))!=NULL)
|
||||
{
|
||||
while(fgets(content_buff, sizeof(content_buff),fp) != NULL) {
|
||||
sprintf(buf," %s",content_buff);
|
||||
setCursor(0, y + i * 10);
|
||||
print_strln(buf);
|
||||
i++;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void testintfstatus(int mode, int y)
|
||||
{
|
||||
char intf[BUFMAX];
|
||||
char status[BUFMAX];
|
||||
char level[BUFMAX];
|
||||
int i = 0;
|
||||
|
||||
setTextSize(1);
|
||||
if((fp=popen(INTFPATH,"r"))!=NULL)
|
||||
{
|
||||
while (true) {
|
||||
int ret = fscanf(fp,"%s %s %s",intf,status,level);
|
||||
if (ret != EOF) {
|
||||
setTextSize(1);
|
||||
//sprintf(buf,"%s %s %s",intf,status,level);
|
||||
sprintf(buf,"%s",intf);
|
||||
setCursor(display_offset + i * 32, y);
|
||||
print_strln(buf);
|
||||
if (strcmp(level,"4/4") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level4_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"3/4") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level3_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"2/4") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level2_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"1/4") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level1_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"0/4") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level0_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"none") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, level0_data, 16, 10, 1);
|
||||
} else if (strcmp(level,"up") == 0) {
|
||||
drawBitmap(display_offset + i * 32, y + 7, levelok_data, 16, 10, 1);
|
||||
//} else {
|
||||
// drawBitmap(display_offset + i * 32, y + 8, level2_data, 16, 10, 1);
|
||||
}
|
||||
//sprintf(buf,"%s",level);
|
||||
//setCursor(display_offset + i * 32, y + 8);
|
||||
//print_strln(buf);
|
||||
i++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void testcputemp(int mode, int y)
|
||||
{
|
||||
|
@ -527,18 +774,18 @@ void testnetspeed(int mode, int y)
|
|||
{
|
||||
case SPLIT:
|
||||
setTextSize(2);
|
||||
if (tx < 1000) sprintf(buf, "%03dB", tx);
|
||||
else if (tx > 1000000) sprintf(buf, "%03dM", tx/1000000);
|
||||
else sprintf(buf, "%03dK", tx/1000);
|
||||
setCursor((127-(strlen(buf)+1)*11)/2,0);
|
||||
oled_write(24);
|
||||
if (tx < 1000) sprintf(buf, "%dB/s", tx);
|
||||
else if (tx > 1000000) sprintf(buf, "%dMb/s", tx/1000000);
|
||||
else sprintf(buf, "%dKb/s", tx/1000);
|
||||
setCursor(30,19);
|
||||
//oled_write(24);
|
||||
print_str(buf);
|
||||
|
||||
if (rx < 1000) sprintf(buf, "%03dB", rx);
|
||||
else if (rx > 1000000) sprintf(buf, "%03dM", rx/1000000);
|
||||
else sprintf(buf, "%03dK", rx/1000);
|
||||
setCursor((127-(strlen(buf)+1)*11)/2,16);
|
||||
oled_write(25);
|
||||
if (rx < 1000) sprintf(buf, "%dB/s", rx);
|
||||
else if (rx > 1000000) sprintf(buf, "%dMb/s", rx/1000000);
|
||||
else sprintf(buf, "%dKb/s", rx/1000);
|
||||
setCursor(30,35);
|
||||
//oled_write(25);
|
||||
print_str(buf);
|
||||
break;
|
||||
case MERGE:
|
||||
|
@ -600,6 +847,7 @@ void testcpu(int y)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void testprintinfo()
|
||||
{
|
||||
setTextSize(1);
|
||||
|
|
|
@ -20,11 +20,16 @@ void testdrawbitmap(const unsigned char *bitmap, unsigned char w, unsigned char
|
|||
void testdrawbitmap_eg();
|
||||
void deeplyembedded_credits();
|
||||
void testprintinfo();
|
||||
void testinfo1();
|
||||
void testinfo2();
|
||||
void testdate(int mode, int y);
|
||||
void testlanip(int mode, int y);
|
||||
void testvpsip(int mode, int y);
|
||||
void testcpufreq(int mode, int y);
|
||||
void testcputemp(int mode, int y);
|
||||
void testnetspeed(int mode, int y);
|
||||
void testintfstatus(int mode, int y);
|
||||
void testcpu(int y);
|
||||
void display_bitmap_uploaddownload();
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue