|
Post by yspede0000 on Aug 12, 2020 22:45:37 GMT -8
Hi I'm trying to solve a problem where I try to load multiple images from Spiffs memory to a FT813's ram. I managed to solve it with 1 image, that is working fine. However if I load multiple images, the first images gets a mix of both images, it is like the screen don't know when the first image stops in ram memory, if I display the second image it shows fine Does anyone have a hint Thanks void setup()
{
Serial.begin(115200);
if(!SPIFFS.begin(true)){
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
GD.begin(0);
fs::File f = SPIFFS.open("/image1.png", "r");
byte var1[f.size()];
int i = 0;
while (f.available())
{
var1[i] = (byte)f.read();
i++;
}
GD.BitmapHandle(1);
GD.cmd_loadimage(0, 0); // load in first space GD.copyram(var1, f.size());
f.close();
fs::File f2 = SPIFFS.open("/image2.png", "r");
byte var2[f.size()];
int i = 0;
while (f2.available())
{
var2[i] = (byte)f2.read();
i++;
}
GD.BitmapHandle(2);
GD.cmd_loadimage(-1, 0); // load after image 1 GD.copyram(var2, f2.size());
f2.close();
void loop()
{ GD.Clear(); if(touch1 = 1){ Screen1(); } else { Screen2(); } GD.swap(); }
void Screen1(){
GD.Begin(BITMAPS);
GD.Vertex2ii(GD.w / 2, GD.h/2, 1, 0);
}
void Screen2(){
GD.Begin(BITMAPS);
GD.Vertex2ii(GD.w / 2, GD.h/2, 2, 0);
}
|
|