-
Notifications
You must be signed in to change notification settings - Fork 564
More than 10 messages a second gives error LmacRxBlk:1 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
yes you can try to clock the ESP at 160Mhz to get more processing power, if that is failing too, github supports markdown for posting code see: |
Markus, in WebSockets::sendFrame , you are currently making 2 client->tcp.write() calls:
These "writes" take approximately 200ms even if you send 1 byte !. They are expensive. I think , for advanced users we may offer ability to reserve a pre-buffer of 16 bytes before payload. This can be for example set with a flag : payload_has_prebufer16, then if this flag is set we know there's space reserved by advanced user before payload: Then we can copy the buffer[i] before payload[0] and do a single write : client->tcp.write(&payload[0] - i, length + i); This way we don't need to copy payload and buffer to another common location, although this could be another option ! |
@starlino yes a implementation like this is possible, and we save the second package. |
thanks @starlino for the idea. example: case WStype_TEXT:
{
Serial1.printf("[%u] get Text: %s\n", num, payload);
uint8_t * buffer = (uint8_t *) malloc(lenght + 14);
if(buffer) {
memcpy((buffer+14), payload, lenght);
// send data to all connected clients
webSocket.broadcastTXT(buffer, lenght, true);
free(buffer);
}
}
break; |
A message every 40ms (25 frames per sec) would also be acceptable.(about the minimum for the human eye to perceive it as motion). Is this feasible? |
i can send a message every 20ms from browser to the ESP. the ESP send it back to the browser. |
Markus, wow ,20ms per packet is great ! Can it be because you're sending packets from computer and it is grouping them into single TCP packet ? But then I can't explain how the response comes back. From my experiments ESP cannot send packets faster then 200ms. However I can send large packets , so I can transfer a lot of data as long as I group them in large packets. It could be because of my router and frame size. To test the real throughput of your ESP I wrote a little test, it basically sends small, then larger and larger packets from ESP to your computer. You must connect to your ESP via telnet and it will run the test. It also shows how you can use a timer (Ticker) to do things in the background while you wait for your packet to be sent. In this example we're simply increment the ticker_count every 10ms. If anyone can run this test and share the results for different packet sizes , it would be great to compare. P.S. I found that server.setNoDelay(false); and serverClient.setNoDelay(false); makes no significant difference for me , does it do anything for you ?
|
I am not sure if I understand why you have the ticker in there. test result setNoDelay(false);
setNoDelay(true);
setup:
|
My test results. setNoDelay(false):
setNoDelay(true):
Setup:
Maybe usefull: With the same setup, I also experimented with xmlhttp requests(xhr) and keeping the connection open, adding packets of data to the message (by the esp-01), reading partial message info (in html), I could achieve 18-20 additions per second (almost independent of block size). The test results above indicate the same number of packets per second.. |
Using the server example and the html in the test subfolder, the updates (time messages) come in at 1 update every second. If I lower the html polling interval to <100ms it crashes with a message LmacRxBlk:1, which as I understand is a full buffer, but can't find a way to circumvent this. Is this maybe a bug?
I can't figure out what is wrong. Any help appreciated!
I tried to attach the html code but can't. Below the html with all <> replaced by []
[html]
[head]
[script]
var connection = new WebSocket('ws://192.168.0.13:81/test', ['arduino']);
connection.onopen = function () {
connection.send('Message from Browser to ESP8266 yay its Working!! ' + new Date());
connection.send('ping');
setTimeout(refresh,3000);
};
connection.onerror = function (error) {
console.log('WebSocket Error ', error);
};
connection.onmessage = function (e) {
console.log('Server: ', e.data);
};
function refresh(){
connection.send('Time: ' + new Date());
setTimeout(refresh,50);
}
[/script]
[/head]
[body]
Test Websocket.
[/body]
[/html]
The text was updated successfully, but these errors were encountered: