fustyles / Arduino

387 stars 285 forks source link

Esp32cam sd google drive #3

Open Vicentetomas opened 4 years ago

Vicentetomas commented 4 years ago

Hi,

First of all. Congrats for your work. I’m not sure if this is the right place to put this comment. Regarding the Esp32cam sd google drive. Is it possible to give me an idea how to implement the follow? Sometimes I don’t have an internet connection. I would like to store the images in the sd and when internet connection is on then upload all the files to the drive.

I hope you can help me how to do it. Thank you for your time.

fustyles commented 4 years ago

You can create a file "list.txt" in SD to record the uploaded files name. If the images in SD are not in the list, upload them.

Rudolf10000 commented 3 years ago

Hi, also from my side congrats to this awesome "OPUS". I have the same issu with upload from SD card to Google Drive. I cant manage to imploy the .jpeg file from SD instead of camera fb->buf and fb->len

`
if(client_tcp.connect(myDomain, 443)) {
Serial.println("Connection successful");
// ############### here
char *input = (char *)fb->buf;
char output[base64_enc_len(3)];
String imageFile = "data:image/jpeg;base64,";
// ############### and here
for (int i=0;i<fb->len;i++) {
 base64_encode(output, (input++), 3);
  if (i%3==0) imageFile += urlencode(String(output));
}
String Data = myLineNotifyToken+myFoldername+myFilename+myImage;

client_tcp.println("POST " + myScript + " HTTP/1.1");
client_tcp.println("Host: " + String(myDomain));
client_tcp.println("Content-Length: " + String(Data.length()+imageFile.length()));
client_tcp.println("Content-Type: application/x-www-form-urlencoded");
client_tcp.println("Connection: keep-alive");
client_tcp.println();

client_tcp.print(Data);
int Index;
for (Index = 0; Index < imageFile.length(); Index = Index+1000) {
  client_tcp.print(imageFile.substring(Index, Index+1000));
}

` Could you put us on the right track ? If you can, i could complete my little project and share my upload handling here. Thanks again for your great job.

fustyles commented 3 years ago

Hi, also from my side congrats to this awesome "OPUS". I have the same issu with upload from SD card to Google Drive. I cant manage to imploy the .jpeg file from SD instead of camera fb->buf and fb->len

`
if(client_tcp.connect(myDomain, 443)) {
Serial.println("Connection successful");
// ############### here
char *input = (char *)fb->buf;
char output[base64_enc_len(3)];
String imageFile = "data:image/jpeg;base64,";
// ############### and here
for (int i=0;i<fb->len;i++) {
 base64_encode(output, (input++), 3);
  if (i%3==0) imageFile += urlencode(String(output));
}
String Data = myLineNotifyToken+myFoldername+myFilename+myImage;

client_tcp.println("POST " + myScript + " HTTP/1.1");
client_tcp.println("Host: " + String(myDomain));
client_tcp.println("Content-Length: " + String(Data.length()+imageFile.length()));
client_tcp.println("Content-Type: application/x-www-form-urlencoded");
client_tcp.println("Connection: keep-alive");
client_tcp.println();

client_tcp.print(Data);
int Index;
for (Index = 0; Index < imageFile.length(); Index = Index+1000) {
  client_tcp.print(imageFile.substring(Index, Index+1000));
}

` Could you put us on the right track ? If you can, i could complete my little project and share my upload handling here. Thanks again for your great job.

I wrote a sample code for you. https://youtu.be/NLhK7RIUv1Q

Source https://github.com/fustyles/Arduino/tree/master/ESP32-CAM_SD_GoogleDrive

Rudolf10000 commented 3 years ago

Thank you so much, fustyles. Unfortunately i can't make the sketch run. I get a guru meditation and reboot on this line

fileinput[fileSize] = '\0';

Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. Core 1 register dump: PC : 0x400d0cad PS : 0x00060c30 A0 : 0x800d1694 A1 : 0x3ffb1d90
A2 : 0x3ffb1f80 A3 : 0x3ffc1b4c A4 : 0x3f40057e A5 : 0x3ffc1ae4
A6 : 0x002d78d1 A7 : 0x3ffb1d90 A8 : 0x002d78d1 A9 : 0x00000000
A10 : 0x3ffc1b4c A11 : 0x3f400273 A12 : 0x002d78d1 A13 : 0x3ffc6560
A14 : 0x3ffc1ae4 A15 : 0xff000000 SAR : 0x00000008 EXCCAUSE: 0x0000001d
EXCVADDR: 0x002d78d1 LBEG : 0x4008d331 LEND : 0x4008d341 LCOUNT : 0xffffffff

ELF file SHA256: 0000000000000000

Backtrace: 0x400d0cad:0x3ffb1d90 0x400d1691:0x3ffb1f50 0x400d57b2:0x3ffb1fb0 0x4008ef56:0x3ffb1fd0

Seems the Guru appears because of a wrong String usage, but i am not so experienced in coding. I also tried a lot of different jpeg images and different AI Thinker esp32-cam boards I use Arduino IDE 1.8.15 and esp 1.0.6 (latest) What am i doing wrong ? Am i missing a custom string library? Thank you so much for your support.

fustyles commented 3 years ago

I think the error cauesd by other reasons. Did you modify my code?

Rudolf10000 commented 3 years ago

No , i did not modify. I installed the exception decoder and got :

PC: 0x400d0c4f: sendSDImageToGoogleDrive(String) at C:\Users\rwolf\Documents\Arduino\Sketchbook\ ESP32-CAM_SD_GoogleDrive/ESP32-CAM_SD_GoogleDrive.ino line 177 EXCVADDR: 0x0002b3a5

This is Line 177 - fileinput[fileSize] = '\0';

Decoding stack results 0x400d0c4f: sendSDImageToGoogleDrive(String) at C:\Users\rwolf\Documents\Arduino\Sketchbook\ESP32-CAM_SD_GoogleDrive/ESP32-CAM_SD_GoogleDrive.ino line 177 0x400d162d: setup() at C:\Users\rwolf\Documents\Arduino\Sketchbook\ESP32-CAM_SD_GoogleDrive/ESP32-CAM_SD_GoogleDrive.ino line 147 0x400d574e: loopTask(void*) at C:\Users\rwolf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32\main.cpp line 18 0x4008ef56: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

Ater reading blogs about strings, i tried a lot of things, but without any result. Any idea what i am doing wrong ? I've never used malloc before. Could that be a reason ?

fustyles commented 3 years ago

Please email your sketch to me. france.fu@msa.hinet.net

The sketch compiled well for me and my friends. You may need to update the latest supported Visual C++ redistributable packages. Try to update your computer OS to the latest version. Does your computer install Microsoft OS? Mine is Microsoft OS.

fustyles commented 3 years ago

Please try to remove all Chinese words in the sketch and compile again.

lucasroth commented 2 years ago

Hi @fustyles thanks for your video and code! I am getting a: "Guru Meditation Error: Core 1 panic'ed (LoadProhibited)" in the line: base64_encode(output, (input++), 3); after commenting out the line: fileinput[fileSize] = '\0'; Where I get a core panic "Store Error" just like @Rudolf10000 stated.

Any ideas of what might be happening? I had try with different sd cards has no changes, same errors described above, also no chinese words are in the sketch.