Giter Site home page Giter Site logo

Comments (8)

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

the async lib is connected directly to the network stack and it gets it's data through callbacks. I do not think that those callbacks are interrupt based or we would not have had the need to call yield.
As for the WS2812B, what lib are you using and how is it pumping the data to the pixels? I2S, UART or bitbang?
The regular stuff (non-async) works much the same, but it's waiting for all the data to come instead of getting it as it comes, so maybe some yield is causing the network to spend time in a moment where the pixels should be getting data.

from espasyncwebserver.

hallard avatar hallard commented on June 23, 2024

Thanks, good to know about stack.
I'm using latest neopixelbus with bitbang800KHz for WS2812. I will investigate on this issue later, something to learn about Async since I'm using the whole, including, WebSocket, ArduinoJSON, SPIFFS, ....

By the way not sure if it's related but now calling WifI.scanNetworks() returns 0, did you noticed that point ? (But I'm connecting to my AP without any problem)

  int n = WiFi.scanNetworks();
  // Just to debug where we are
  Debugf("found %d networks!",n);

Another question, from WebSocket handler, how to get the client IP from AsyncWebSocketClient * client ?

from espasyncwebserver.

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

yeah... need to add access to the client IP/Port...
as for WiFi.scanNetworks() do not call it inside async callbacks or run it in async mode and check for the result. If you are not calling it from there, then I have no clue

from espasyncwebserver.

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

here is access to IP/Port
8dfd328

from espasyncwebserver.

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

maybe you should try Uart or DMA mode for the pixels, since they have buffers to smooth things out :)

from espasyncwebserver.

hallard avatar hallard commented on June 23, 2024

yeah, but with GPIO of my project I can't use DMA or Uart.
But anyway, in fact LED are working fine (controlling them) it's just the animation (breathing) that seems impacted.
NeoPixel animation is run in main loop lot of time and I suspect Async task could sometime slow down main task and miss some breathing steps. I need to check this point, mainly the example I'm using is this one from NeoPixel Examples.
https://github.com/Makuna/NeoPixelBus/blob/master/examples/NeoPixelFunFadeInOut/NeoPixelFunFadeInOut.ino
I will merge basic AsyncWebServer into this sample just to see. My main project is so big and doing so much stuff that's it's difficult to isolate such kind of issues.
Anyway, thank you very much for you help

from espasyncwebserver.

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

yes, I suspect the animation is yielding somewhere and that switches the context and causes delay in between commands

from espasyncwebserver.

hallard avatar hallard commented on June 23, 2024

@me-no-dev
I've done some test, that's strange, on the main loop I'm calling a function so set builtin led and read on board switch (setting GPIO0 input, read it and setting back to output).
On board switch is on GPIO0 shared with WS2812, until async no flickering pb.
I tried to start/stop animation when realing GPIO as also disable/enable interrupts, but nothing really worked.
Anyway, not really an issue I've commented out the code that was reading GPIO0 and now all works fine with RGB Led and AsyncWebServer
Not sure to understand what the source of the problem but always not really good idea to share pin

Here my code for information

/* ======================================================================
Function: handle_key_led 
Purpose : Manage on board Led and Push button of NodeMCU
Input   : true to light on the led, false to light off
Output  : true if button is pressed
Comments: on NodeMCU BUILTIN_LED is GPIO16 and switch (Flash) on GPIO 0
====================================================================== */
uint8_t handle_key_led( uint8_t level)
{
  uint8_t btn=true;
  digitalWrite(BUILTIN_LED, 1);
  pinMode(BUILTIN_LED, OUTPUT);
  digitalWrite(BUILTIN_LED, !level);

  //animations.Pause();
  //noInterrupts(); // Need 100% focus on instruction timing
  // Flash is on GPIO0, so RGB LED
  //pinMode(0, INPUT);
  //btn = digitalRead(0);
  //pinMode(0, OUTPUT); // set back to output
  //interrupts();
  //animations.Resume();
  return !btn;
}

from espasyncwebserver.

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.