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
|
|
@ -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) {
|
||||
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);
|
||||
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));}
|
||||
Display();
|
||||
usleep(1000000);
|
||||
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));}
|
||||
}
|
||||
Display();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
}
|
||||
}
|
||||
testintfstatus(FULL, 0);
|
||||
display_bitmap_uploaddownload();
|
||||
testnetspeed(SPLIT, 120);
|
||||
testvpsip(FULL, 52);
|
||||
Display();
|
||||
usleep(5000000);
|
||||
clearDisplay();
|
||||
testinfo1();
|
||||
Display();
|
||||
usleep(1000000);
|
||||
clearDisplay();
|
||||
testinfo2();
|
||||
Display();
|
||||
usleep(800000);
|
||||
clearDisplay();
|
||||
testinfo3();
|
||||
Display();
|
||||
usleep(200000);
|
||||
clearDisplay();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue