How to pause requests in ESPAsyncWebServer?

denismix
Posts: 1
Joined: Sat Aug 22, 2020 8:15 pm

How to pause requests in ESPAsyncWebServer?

Postby denismix » Sat Aug 22, 2020 9:08 pm

This is probably the strangest question about the work of an asynchronous server ... =)

I have Arduino ESP32 project: asynchronous server + the control of mechanics.

The first phase (which requires an asynchronous server):
Initial loading of a large file needed for work, various settings. Active exchange of JSON packages with several clients. Mechanics are not controlled.

Second phase:
Don't need to download anything "heavy".
Arduino controls a mechanical process, a stepper motor. When Arduino drives a stepper motor, every microsecond is important for smooth movement - the process should not be interrupted by anything.
:arrow: But the server at some moments, especially when there is a request to reload the page, starts to slow down the engine control, the movement becomes "jerky", with micro-delays. This is completely unacceptable, as the movement of the engine cannot be stopped in the middle of its cycle in order to wait for the server to process the request.
When no client is connected to the server, the stepper motor control is completely smooth.

In terms of time, the cycle in the second phase is as follows:
1. Approximately 1-2 seconds the stepper motor works (at this time, it is desirable that Arduino is only engaged in its control)
2. About 2-3 seconds the server can send and receive requests as and when it is convenient for it (at this time, any delays are not important for the project)

:?: Question.
Is it possible to somehow avoid delays from the asynchronous server while the stepper motor is being controlled?
For example, to suspend the processing of requests or the entire server, or indicate that the code is being executed that cannot be interrupted by asynchronous processes?

Who is online

Users browsing this forum: No registered users and 71 guests