Skip to content

Add Serial buffer for performance improvement#533

Open
unlogisch04 wants to merge 13 commits into
mainfrom
serial-buffer
Open

Add Serial buffer for performance improvement#533
unlogisch04 wants to merge 13 commits into
mainfrom
serial-buffer

Conversation

@unlogisch04

Copy link
Copy Markdown
Contributor

this PR goes on top of #532
Serial Writes did take up to 54ms to write out the SerialCommands::printState();

After digging deeper i found out that the esp8266 frameworks blocks till all chars are printed out.
In taking advantage of the HW Buffer (128Bytes), to only write the set amount of chars to the buffer the blocking behavior can be avoided. (from 54 ms to about ~400us each cycle)
Arduino has the free bytes to write in the function called Serial.availableForWrite()

With this change we can avoid long blocking serial operation.

the Logger function to print Arrays has been removed, and the only instance used converted.

There are many places Serial.Print.. is still used, that might show out of place:

  • ota,cpp "[NOTICE] OTA updates allowed", "[NOTICE] OTA updates disabled by timeout, this is not an error"
  • wifihandler.cpp (the ".")
  • serialcommands.cpp (only 1 instance for get config)
  • i2cscan (all the places)

gorbit99 and others added 6 commits June 6, 2026 01:36
Co-authored-by: unlogisch04 <98281608+unlogisch04@users.noreply.github.com>
Co-authored-by: unlogisch04 <98281608+unlogisch04@users.noreply.github.com>
@Eirenliel

Copy link
Copy Markdown
Member

Please rebase

@gorbit99 gorbit99 requested a review from Eirenliel June 9, 2026 01:53
@gorbit99

gorbit99 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Before this is merged, I want to make sure the buffer is flushed even in the setup method of the code, at the moment it's not doing that

@unlogisch04

Copy link
Copy Markdown
Contributor Author

good catch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants