GithubHelp home page GithubHelp logo

dmx_receive blocking about esp_dmx HOT 6 CLOSED

someweisguy avatar someweisguy commented on May 23, 2024
dmx_receive blocking

from esp_dmx.

Comments (6)

someweisguy avatar someweisguy commented on May 23, 2024 1

Thanks for the code link. It is possible that this is related to interrupts clashing. It should be possible to check this by adjusting the DMX driver interrupt priority. The constant ESP_INTR_FLAG_LEVEL3 should work when installing your DMX driver. In other words, instead of calling dmx_driver_install(dmx_num, DMX_DEFAULT_INTR_FLAGS), try calling dmx_driver_install(dmx_num, ESP_INTR_FLAG_LEVEL3).

You should also check to ensure that your other components are using lower level interrupts.

from esp_dmx.

someweisguy avatar someweisguy commented on May 23, 2024

The last argument of dmx_receive() is the maximum block time in FreeRTOS ticks. If you set this argument to 0, the function will not block and will return the number of DMX packet slots received.

dmx_packet_t packet;
if (dmx_receive(DMX_NUM_2, &packet, 0)) {
  // Do work if packet is received
}

As a side note, dmx_receive() will only return the number of slots received for a NEW packet. If you call dmx_receive() again with a block time of zero and before a new packet is received, it will return 0.

This is a relatively new feature so let me know if this is not the behavior you see!

from esp_dmx.

netmindz avatar netmindz commented on May 23, 2024

Thanks for the very prompt response, using 0 does resolve my blocking issue. However, I'm now seeing some rather odd glitches with WLEDs output when DMX is active if I then use that.

Is 0 a magic value to trigger a different behavior?

So with the blocking, all is fine when I have DMX, but no signal blocks my main loop for the timeout.
With no blocking, when no DMX all is fine, but when receiving I get very erratic behavior of the WLED output

from esp_dmx.

someweisguy avatar someweisguy commented on May 23, 2024

Setting the block time to 0 should not cause another behavior.

What do you mean by erratic behavior? Do you mind sharing your code?

from esp_dmx.

netmindz avatar netmindz commented on May 23, 2024

The LEDs star showing incorrect values, I wondered if we were seeing clashing interrupts

https://github.com/netmindz/WLED/blob/DMX-Input-esp_dmx/wled00/dmx.cpp

from esp_dmx.

netmindz avatar netmindz commented on May 23, 2024

That seems to be working nicely, thank you

from esp_dmx.

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.