|
|
|
|
@ -13,8 +13,50 @@ static esp_err_t init_camera();
|
|
|
|
|
#define FORMAT_SPIFFS_IF_FAILED true
|
|
|
|
|
|
|
|
|
|
camera_fb_t *pic;
|
|
|
|
|
//File inFile;
|
|
|
|
|
//File outFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// example code from https://github.com/espressif/arduino-esp32/blob/master/libraries/LittleFS/examples/LITTLEFS_test/LITTLEFS_test.ino
|
|
|
|
|
//
|
|
|
|
|
void listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
|
|
|
|
|
Serial.printf("Listing directory: %s\r\n", dirname);
|
|
|
|
|
|
|
|
|
|
File root = fs.open(dirname);
|
|
|
|
|
if (!root) {
|
|
|
|
|
Serial.println("- failed to open directory");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!root.isDirectory()) {
|
|
|
|
|
Serial.println(" - not a directory");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File file = root.openNextFile();
|
|
|
|
|
while (file) {
|
|
|
|
|
if (file.isDirectory()) {
|
|
|
|
|
Serial.print(" DIR : ");
|
|
|
|
|
Serial.println(file.name());
|
|
|
|
|
if (levels) {
|
|
|
|
|
listDir(fs, file.name(), levels - 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Serial.print(" FILE: ");
|
|
|
|
|
Serial.print(file.name());
|
|
|
|
|
Serial.print("\tSIZE: ");
|
|
|
|
|
Serial.println(file.size());
|
|
|
|
|
}
|
|
|
|
|
file = root.openNextFile();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deleteFile(fs::FS &fs, const char * path) {
|
|
|
|
|
Serial.printf("Deleting file: %s\r\n", path);
|
|
|
|
|
if (fs.remove(path)) {
|
|
|
|
|
Serial.println("- file deleted");
|
|
|
|
|
} else {
|
|
|
|
|
Serial.println("- delete failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
// put your setup code here, to run once:
|
|
|
|
|
@ -35,8 +77,8 @@ void setup() {
|
|
|
|
|
Serial.println("SPIFFS Mount Failed");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
listDir(SPIFFS, "/", 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
@ -69,6 +111,8 @@ void loop() {
|
|
|
|
|
char filename[] = "/cam.bin";
|
|
|
|
|
|
|
|
|
|
save_camera_image(filename);
|
|
|
|
|
|
|
|
|
|
listDir(SPIFFS, "/", 0);
|
|
|
|
|
|
|
|
|
|
picosstvpp();
|
|
|
|
|
|
|
|
|
|
|