GithubHelp home page GithubHelp logo

how to handle multiple comonents calling install_gpio_isr_service/uninstall_gpio_isr_service/gpio_isr_handler_add about esp32-camera HOT 9 OPEN

greenaddress avatar greenaddress commented on June 30, 2024 1
how to handle multiple comonents calling install_gpio_isr_service/uninstall_gpio_isr_service/gpio_isr_handler_add

from esp32-camera.

Comments (9)

igrr avatar igrr commented on June 30, 2024 1

My opinion is that installing system-wide services should be done in application code, not in libraries. This applies also to things such as NVS, esp_event, esp_netif.

It would probably be a breaking change to remove the call to an GPIO service installation function, but we could at least add config argument specifying whether esp32_camera should install the GPIO service or not.

(We could also change the GPIO service API to have something like a reference counter, allowing it to be installed and uninstalled any number of times. But this would only be available in new versions of IDF, so we need another solution for esp32_camera anyway.)

from esp32-camera.

AxelLin avatar AxelLin commented on June 30, 2024

I asked the same (similar) question in espressif/esp-idf#12882 (comment) , but didn't get further response.

from esp32-camera.

AxelLin avatar AxelLin commented on June 30, 2024

My opinion is that installing system-wide services should be done in application code, not in libraries. This applies also to things such as NVS, esp_event, esp_netif.

Then I'm wondering if the application developer really understand what intr_alloc_flags should be set.

What happens if wrong intr_alloc_flags is used for gpio_install_isr_service?
e.g. currently, only the first call to gpio_install_isr_service() takes effect.
So the intr_alloc_flags called by ll_cam.c does not take effect if other component already calls gpio_install_isr_service().

from esp32-camera.

igrr avatar igrr commented on June 30, 2024

Yeah, unfortunately that's the complexity the application developer currently needs to bear.

If we were to change gpio_isr_handler_add to also take the flags, we could at least error out on calls to gpio_isr_handler_add with incompatible flags (i.e. higher interrupt level than requested in gpio_install_isr_service, or IRAM flag, when gpio_install_isr_service hasn't requested it.)

The reference counting approach I mentioned above wouldn't solve this particular issue, I think, because we can't re-register the ISR with different flags without potentially missing some interrupts — on Xtensa, at least.

from esp32-camera.

AxelLin avatar AxelLin commented on June 30, 2024

From version 2.0.4 throughout version 2.0.8 (latest stable) esp32-camera calls uninstall_gpio_isr_service from within esp_camera_deinit which can "break" other components that relied on the isr_service presence.

This was introduced in this MR #516

@me-no-dev
Any update for this issue?

from esp32-camera.

me-no-dev avatar me-no-dev commented on June 30, 2024

@AxelLin will revert this and check for "already started" on init. I see no other options to help the situation

from esp32-camera.

AxelLin avatar AxelLin commented on June 30, 2024

@AxelLin will revert this and check for "already started" on init. I see no other options to help the situation

my main concern is not about "already started" on init, but about the uninstall_gpio_isr_service from within esp_camera_deinit which can "break" other components.

from esp32-camera.

me-no-dev avatar me-no-dev commented on June 30, 2024

both things need to happen in order for the driver to be restarted and ISR service to not be re-initialized. The PR you linked above was attempting to fix failed re-init, because "service is already started"

from esp32-camera.

me-no-dev avatar me-no-dev commented on June 30, 2024

Change is reverted: 2829692

from esp32-camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.