s60sc / ESP32-CAM_MJPEG2SD

ESP32 Camera motion capture application to record JPEGs to SD card as AVI files and stream to browser as MJPEG. If a microphone is installed then a WAV file is also created. Files can be uploaded via FTP or downloaded to browser.
GNU Affero General Public License v3.0
931 stars 214 forks source link

Only able to run with Serial monitor opened? #253

Closed jlutzwpi closed 1 year ago

jlutzwpi commented 1 year ago

Hello again, really enjoying this code. It works great. Seeing 20 fps being recorded to SD. However, it looks like the webserver only starts up when a Serial monitor is opened. I would like to try to a battery-powered solution where I'm not connected via USB-C with a Serial monitor open. Is there a way to disable that? Typically it's a while(!Serial) call but there is a whole logging system so not sure if a similar command is issued elsewhere. Thanks!

s60sc commented 1 year ago

Nothing to do with app. Hardware issue?

jlutzwpi commented 1 year ago

OK, found the issue: had to comment out the following:

if (!strlen(ST_SSID)) wlStat = WL_NO_SSID_AVAIL;
  else {
    while (wlStat = WiFi.status(), wlStat != WL_CONNECTED && millis() - startAttemptTime < 5000)  {
     //comment out these lines to run without Serial monitor open
      //Serial.print(".");
      //delay(500);
      //Serial.flush();
    }
  }

I think it is just the Serial.flush() that causes the dependency because there are other Serial.println's throughout the code and I can now connect without the Serial monitor open.

s60sc commented 1 year ago

Appears to be an S3 specific problem try

#if !CONFIG_IDF_TARGET_ESP32S3
      Serial.flush();
#endif
s60sc commented 1 year ago

There is an existing arduino-esp issue

does the following work

if (Serial) Serial.flush();

jlutzwpi commented 1 year ago

Huh, how about that? I loaded the MCU into my model rocket payload already, so I'll give that a try post-launch. Thanks for digging that up. I just commented it out for the time being since I didn't really need that debug capability if I'm running battery-powered. Thanks again!

s60sc commented 1 year ago

new 8.7.4