ayushsharma82 / WebSerial

A remote terminal library for wireless microcontrollers to log, monitor or debug your firmware/product
https://webserial.pro
GNU Affero General Public License v3.0
461 stars 107 forks source link

Timing Issue - Need delay between multiple WebSerial.println commands #65

Closed JMWilton closed 2 weeks ago

JMWilton commented 1 year ago

When executing the following code: WebSerial.println(WiFi.localIP()); //delay(500); WebSerial.println("joe was here"); // delay(500); WebSerial.println("this is now");

The output is: image

When executing the following code: WebSerial.println(WiFi.localIP()); delay(500); WebSerial.println("joe was here"); delay(500); WebSerial.println("this is now");

The output is: image

It appears that subsequent WebSerial.println commands overwrite the previous WebSerial.println command if there is an insufficient delay. It would be expected that no delay should be necessary.

JMWilton commented 1 year ago

I have implemented a workaround: int SerialMonitorDelay = 0; template void SerialMonitor_Println (T param) {if (SerialMonitorDelay>0) {WebSerial.println(param); delay (SerialMonitorDelay);}} // Workaround to eliminate overwriting previous output template void SerialMonitor_Print (T param) {if (SerialMonitorDelay>0) {WebSerial.print (param); delay (SerialMonitorDelay);}} // Workaround to eliminate overwriting previous output

SerialMonitorDelay is set to a non-zero value via a message from the client web page. This eliminates a delay if no client is attached. The delay can be controlled by the value sent from the client page. Monitoring can be turned back off by sending a zero value.

asjdf commented 1 year ago

I thought you just fill the send-queue. This issue wasn't caused by this lib.

JMWilton commented 1 year ago

I now suspect that the html receive event code might be reentered before it finishes its work.

asjdf commented 1 year ago

I thought this issue might be help

https://github.com/asjdf/WebSerialLite/issues/4#issuecomment-1342696623

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 5 days with no activity.