You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Play/_718/fileread.ino

124 lines
2.6 KiB

void readfile()
{w=0;
bufer="";
int a=0,b=0;
byte st=0;
int cardSize;
myGLCD.setColor(22,18,70);
myGLCD.fillRoundRect (380,145, 630, 475);
myGLCD.setColor(VGA_WHITE);
myGLCD.drawRoundRect (380,145, 630, 475);
myGLCD.setFont(SmallFont);
myGLCD.setColor(255,255,255);
myGLCD.setBackColor(0,38,92);
myGLCD.drawBitmap (639, 370, 160, 80, cl);
myGLCD.drawRoundRect (639, 370, 799, 450); //Clok
clc();
myGLCD.setBackColor(22,18,70);
myGLCD.setColor(VGA_WHITE);
sd.chdir("/");
delay(100);
myFile.open(name, O_READ);
cardSize=myFile.fileSize();
// myGLCD.print("cardSize=",10,10);
// myGLCD.printNumI(cardSize,10,30);
st=0;
w=0;
for (int i=0 ; i < cardSize; i = i++)
{ char ByteRead=myFile.read(); //чтение данных с порта
if (ByteRead==char(13))//окончание строки
{ analyzer(); //передача данных на обработку
myFile.read();
bufer="";
st=0;
}
else {
bufer=bufer+char(ByteRead);
st++;
if(st>28)
{st=0;
analyzer();
bufer="";
}
} ///накопление данных в буфер
if (fcl==1)
{fcl=0;
goto clos;
}
}
analyzer(); //передача данных на обработку
clos:
myFile.close();
myGLCD.setColor(22,18,70);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print(" pres exit to return ",393,463);
myGLCD.setBackColor(22,18,70);
myGLCD.setColor(VGA_WHITE);
}
//**************************************************************************
void analyzer()
{ myGLCD.setFont(SmallFont);
myGLCD.setBackColor(22,18,70);
myGLCD.setColor(VGA_WHITE);
w++;
myGLCD.print(bufer,385,147-12+12*w);
delay(100);
boolean b=0;
if(w>25)
{w=0;
myGLCD.setColor(22,18,70);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print(" pres touch to continion ",393,463);
myGLCD.setBackColor(22,18,70);
myGLCD.setColor(VGA_WHITE);
while(b<1)
{delay(200);
if (myTouch.dataAvailable())
{
myTouch.read();
int x=myTouch.getX();
int y=myTouch.getY();
if ((x>=380) && (x<=630)) // open
{
if ((y>=150) && (y<=470)) // 640, 240, 680, 280); //open
{ b=2;
myGLCD.setColor(22,18,70);
myGLCD.fillRoundRect (380,145, 630, 475);
myGLCD.setColor(VGA_WHITE);
myGLCD.drawRoundRect (380,145, 630, 475);
}
}
if ((x<380) || (x>630)) // open
{fcl=1;
b=2;
}
}
}
}
}