FILe.readBytes( ((char*)leds) + i, (NUM_LEDS*3)-i);
this worked
virtual size_t fs::File::readBytes(char*, size_t)
I run the POV project with teensy1.2 which is read image lines from SD card and show it in LED strip , each image consist of 300 line 144 pixel 3 byte (about 127 Kbyte)of data which is show in less than 40ms (25 fps)
Then I’ve tried to port it to ESP module , the loop function consist three condition along with wifi websocket service
The first condition check whether duration of show is passed and is time to close last file and open the new file
if( (millis()- OpenlastTime) > DURATION[image_index]*1000L )
{
FILe.close();
image_index++;
if(image_index>IMAGE_NUM) image_index=0;
FILe=SPIFFS.open("/SHOW/"+IMAGES[image_index], "r");
if(!FILe) Serial.println("FILE NOT OPEN");
OpenlastTime=millis();
}
The second condition check whether new revolution started and time duration of last line has been passed , it read one chunk of data (number of LED * 3) and fed to show function to display it
if(!Start_new_round && (micros()-lastLineShow)> lineInterval)
{
int i = 0;
while( (i < NUM_LEDS*3) && FILe.available())
{
i += FILe.readBytes( ((char*)leds) + i, (NUM_LEDS*3)-i);
}
FastLED.show();
lastLineShow=micros();
Current_imageLine++;
}
The third condition check whether it reach the total line of frame or not , if yes set the file read as beginning and reset to show the frame again
if(Current_imageLine >= IMAGES_LINES)
{
Serial.print("[frame]"); Serial.println((micros()-lastFrameShow));
Current_imageLine = 0;
lastFrameShow=micros();
Start_new_round=false;
FILe.seek(0, SeekSet);
}
But when I calculate the time of each frame it is huge and beyond expectation
More than 1 second for each frame , following is the serial output
i=0 New Image=1.bin duration=4
[frame]1639135
[frame]1571890
i=1 New Image=3.bin duration=4
[frame]1580551
[frame]1038532
[frame]1038509
[frame]1038295
i=2 New Image=2.bin duration=4
[frame]1064185
[frame]1083934
[frame]1085061
[frame]1085059
I don’t know where my time is wasted or which procedure took so long
Just an extra data point for you, for comparison. Running Arduino 1.6.9/ESP8266 2.3.0 on a NodeMCU Amica 1.0, 3MByte SPIFFS (80MHz), I get an average of 1.5Mbyte/s read (M=1000), max 2.1MB/s, min 1.1Mbit/s, median 1.4 - values are rather variable for the 7 successful test loops before write error.
What type is your ESP-xx module exactly ?
if( (millis()- OpenlastTime) > DURATION[image_index]*1000L )
{
FILe.close();
image_index++;
if(image_index>IMAGE_NUM) image_index=0;
FILe=SPIFFS.open("/SHOW/"+IMAGES[image_index], "r");
if(!FILe) Serial.println("FILE NOT OPEN");
OpenlastTime=millis();
}