shariltumin / esp32-cam-micropython-2022

MicroPython esp32-cam firmware with camera support compiled with esp-idf-4.4.0. Python script files for live streaming
MIT License
174 stars 33 forks source link

machine.reset() sometimes fails #47

Closed davefes closed 2 months ago

davefes commented 2 months ago

Latest image on a ESP32 Generic.

When doing a machine.reset() sometimes get the following:

E (3070) camera: Camera probe failed with error 0x105(ESP_ERR_NOT_FOUND) E (3070) camera: Camera Init Failed E (3070) camera: Camera deinit Failed E (4130) camera: Camera probe failed with error 0x105(ESP_ERR_NOT_FOUND) E (4130) camera: Camera Init Failed E (4130) camera: Quality Failed E (4130) camera: Special Effect Failed

A power-on-reset clears this problem. Any suggestions?

Thanks

shariltumin commented 2 months ago

Have you try camera.deinit() before calling machine.reset() ?

davefes commented 2 months ago

I will try that. It is a random event.

I start every program with:

# during development
if machine.reset_cause() == machine.SOFT_RESET:
    print('you got a SOFT_RESET, so do a machine.reset()')
    time.sleep(1)
    machine.reset()

and it fails here before any camera init happens. Ah, import camera has happened before this.

davefes commented 2 months ago

Putting camera_deinit()gives a E (1070) camera: Camera deinit Failed which is not surprising as the camera has not been initialised. My original error appeared to go away.

If I import camera after my SOFT_RESET test everything works properly.

Thank you.