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
497 stars 109 forks source link

Added WebSerialLite: a lightweight high-performance version of WebSerial #78

Closed mathieucarbou closed 3 months ago

mathieucarbou commented 3 months ago

This is how I use WebSerial in my projects. I have a mechanism to stream Arduino logs to both Serial and WebSerial.

I need real-time and speed, I cannot buffer since I would lose some precious logging happening just before an ESP restart for example.

In this PR I've ported the building bricks for such use case in this project:

mathieucarbou commented 3 months ago

Additional note: I will look to add that in the pro version and my projects, but as mentioned in #79, not having a command history in the free version is really a blocker to integrate it in some others.

ayushsharma82 commented 3 months ago

@mathieucarbou , Let's integrate it as an switch with macro. So those who want to use it can switch the implementation with setting the macro to 1. Having two different classes is difficult for me to explain and keep in a product.

mathieucarbou commented 3 months ago

OK I will review the PR soon

mathieucarbou commented 3 months ago

@ayushsharma82 : PR ready to review and includes #81

I made it in a way that the public methods are the same, and we can switch the flag without having to update the code. In example, in the high perf version, the loop() is a no-op.

I struggled for the Arduino CI and gave up. Apparently it is not possible to set extra build flags because setting them would override the ones from the platforms.txt (build.extra_flags=-DESP8266) and consequently loose the information about the platform type. And since the same run command is used for several env (matrix build), I cannot fix it.

But in any case, we have the PIO build which is easier to maintain and run fine with and without the flag.

I also manually tested both versions with 2 examples.

ayushsharma82 commented 3 months ago

Looks really good! 👍🏻