Skip to content
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

Disable serial logging when serial not connected #866

Closed
TD-er opened this issue Feb 13, 2018 · 5 comments
Closed

Disable serial logging when serial not connected #866

TD-er opened this issue Feb 13, 2018 · 5 comments
Labels
Type: Enhancement Improve something already present
Milestone

Comments

@TD-er
Copy link
Member

TD-er commented Feb 13, 2018

As suggested here: #847 (comment)
Apparently disable logging to serial when not connected will make the ESP response more smooth, use less memory and will lead to world peace.
If we could achieve at least 2 of these, it is worth to try and auto detect whether the serial port is being read and stop sending logs to serial when it is not being read.

@uzi18
Copy link
Contributor

uzi18 commented Feb 13, 2018 via email

@TD-er
Copy link
Member Author

TD-er commented Feb 13, 2018

The logging is something that really needs some attention.
I was thinking about adding some bit-sets to enable/disable certain categories, like protocol, info, error, debug, etc.
Now it is just a filter and when set high enough, you will get all.

But that's another issue.

For now I am trying to detect whether the FIFO is full.
There is this function Serial.availableForWrite();
But it is always returning 128, regardless the state of the serial port.

So have to look a bit further.
I guess I will commit what I have for now, so others can also take a look (added the output of this test to the sysinfo page)

TD-er added a commit to TD-er/ESPEasy that referenced this issue Feb 14, 2018
First attempt, not clear yet how to detect it.
See letscontrolit#866

Also preparation for future improvement on logging. (to detect whether there is some logging active so Strings may not have to be prepared.
@s0170071
Copy link
Contributor

  • Less

memory - that could be done. Just like with the web server I would try and stream out logs directly instead of building up strings. Problem is that this is done throughout all plugins. So this is quite something.

  • Detecting

a connection may not be possible as from the ESP point of view there is always the USB transceiver connected to it. Whatever pin push and read back magic one would try- unless you get sent back anything from the host I don't think you can auto-detect this.

  • I would go for

disabling serial logging at a certain time after boot. Devs look at it for like two minutes and after that... re-flash. And world peace- were you thinking about a plugin or a more instant solution?

@TD-er
Copy link
Member Author

TD-er commented Feb 14, 2018

Wait with streaming logs.
I was also planning to detect whether it is even needed to generate a log string.

And also allow for proper filtering.

Detection is still an unsolved problem

The last item is also a bit tricky.
Maybe you could fit your streaming solution to do it?
Otherwise I think we have too little resources on the ESP to manage.

@Grovkillen Grovkillen added the Type: Enhancement Improve something already present label Feb 15, 2018
@Grovkillen Grovkillen added this to the 2.1.0 milestone Feb 15, 2018
psy0rz pushed a commit that referenced this issue Feb 16, 2018
)

First attempt, not clear yet how to detect it.
See #866

Also preparation for future improvement on logging. (to detect whether there is some logging active so Strings may not have to be prepared.
@TD-er
Copy link
Member Author

TD-er commented Oct 27, 2019

Current implementation does have some buffer for the log to serial, so logging is no longer blocking
It is impossible to detect whether the serial port is actually read.

So this issue can be closed, since the original issue cannot be implemented and we now have a better fix for the actual problem.

@TD-er TD-er closed this as completed Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improve something already present
Projects
None yet
Development

No branches or pull requests

4 participants