fixed delay issue due impossile reading at the end of a animation file; removed many Serial.print lines
This commit is contained in:
parent
a94ac3d769
commit
6484f6dc71
2 changed files with 5 additions and 7 deletions
|
@ -8,14 +8,11 @@ int getFileFrames(char* file) {
|
||||||
Serial.println("Cannot open file!");
|
Serial.println("Cannot open file!");
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Reading file and trying to find frame counter...");
|
|
||||||
|
|
||||||
while(f.available() && n<0) {
|
while(f.available() && n<0) {
|
||||||
line = f.readStringUntil('\n');
|
line = f.readStringUntil('\n');
|
||||||
n = line.lastIndexOf("FRAME_COUNT");
|
n = line.lastIndexOf("FRAME_COUNT");
|
||||||
}
|
}
|
||||||
Serial.println("Frame Counter found at this line:");
|
|
||||||
Serial.println(line);
|
|
||||||
String strFrameNumber = line.substring(n+12);
|
String strFrameNumber = line.substring(n+12);
|
||||||
result = strFrameNumber.toInt();
|
result = strFrameNumber.toInt();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +53,8 @@ void playFile(char* file, int framespeed) {
|
||||||
}
|
}
|
||||||
strip.Show();
|
strip.Show();
|
||||||
delay(framespeed);
|
delay(framespeed);
|
||||||
line = f.readStringUntil('\n'); line = f.readStringUntil('\n');
|
|
||||||
|
if(frame<frameNumber-1) line = f.readStringUntil('\n'); line = f.readStringUntil('\n');
|
||||||
for(int i=0; i<64; i++) {
|
for(int i=0; i<64; i++) {
|
||||||
delete anim[i];
|
delete anim[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,15 +99,15 @@ void loop() {
|
||||||
Serial.println("All off ...");
|
Serial.println("All off ...");
|
||||||
strip.ClearTo(black);
|
strip.ClearTo(black);
|
||||||
|
|
||||||
Serial.print("Framecounter of file: ");
|
|
||||||
playFile("/Center.c",2000);
|
playFile("/Center.c",2000);
|
||||||
playFile("/Blink_center.c", 100);
|
playFile("/Blink_center.c", 100);
|
||||||
playFile("/Move_left.c", 100);
|
playFile("/Move_left.c", 100);
|
||||||
playFile("/Blink_left.c", 100);
|
playFile("/Blink_left.c", 100);
|
||||||
playFile("/Move_left_center.c", 100);
|
playFile("/Move_left_center.c", 100);
|
||||||
playFile("/Blink_LSD_start.c", 100);
|
playFile("/Blink_LSD_start.c", 100);
|
||||||
playFile("/Blink_LSD.c", 100);
|
playFile("/LSD.c", 100);
|
||||||
playFile("/Blink_LSD.c", 100);
|
playFile("/LSD.c", 120);
|
||||||
|
playFile("/LSD.c", 100);
|
||||||
playFile("/Blink_LSD_end.c", 100);
|
playFile("/Blink_LSD_end.c", 100);
|
||||||
playFile("/Blink_center.c", 100);
|
playFile("/Blink_center.c", 100);
|
||||||
playFile("/Move_right.c", 100);
|
playFile("/Move_right.c", 100);
|
||||||
|
|
Loading…
Reference in a new issue