esphome / esp-web-tools

Open source tools to allow working with ESP devices in the browser
https://esphome.github.io/esp-web-tools/
Apache License 2.0
403 stars 114 forks source link

[Feature] allow serial speed to be increased #277

Open amandel opened 1 year ago

amandel commented 1 year ago

If I flash via command line I use upload_speed of 921600. It would be great if this is also possible via esp-web-tools, might be as a additional parameter (per build) in the manifest?

balloob commented 1 year ago

The reason I haven't made it configurable yet until now is because switching the baud rate on a serial port that has been used before on the old baud rate is causing the serial port in the browser to stop working (and I haven't spend time to investigate why). Ideally we would go to a faster speed when we know it is supported.

The current speed is chosen because it works for both good and shitty UART chips.

Allowing you to configure one means it might not work on every chip. Now as a firmware owner you probably know what you do and don't support so this can be considered.

TD-er commented 1 year ago

Now as a firmware owner you probably know what you do and don't support

Wow, tricky assumption ;)

But on a more serious note, can you see what the current baudrate is?

balloob commented 1 year ago
  1. It's currently defined in 3 different places
TD-er commented 1 year ago

I meant checking the serial port to ask its set baudrate. Not the speed you (try to) set it to.

balloob commented 1 year ago

That's not how it works. We request a port, and then we open it with a specific baudrate (docs)

amandel commented 1 year ago

Thanks for the details. Actually we only use one devkit, but still there are many variants and clones out there. I also like a no options but working solution 😃 so I see your points. But we have groups that install several devices in a row. There it would specially help to speed it up. I'm not too deep into this, would it be sufficient to adjust the 3 places you mentioned with a higher speed? If so, I could give it a try and feedback (will take some time)

balloob commented 1 year ago

If it makes your life easier, you could open a PR first to extract it into a single constant. That would make it configurable later on easier too.

Jason2866 commented 1 year ago

If I flash via command line I use upload_speed of 921600. It would be great if this is also possible via esp-web-tools, might be as a additional parameter (per build) in the manifest?

Flashed a lot of different devices (beeing a member of Tasmota). Tried to increase the speed from 115200 to higher ones. Finally i went back to 115200 as standard for Tasmota setup. Even devices from the same type (which one worked with higher serial speed) are not safe to use with higher speeds. You never know what clone USB serial chip is used.

I believe, you like more not to do unnecessary issue work. So it is just telling some users the speed used is the safe one.

I had until now, no Tasmota user complaining about the speed when using the Tasmota Web Installer. Almost everyone is happy how simple it is to get the firmware installed.

amandel commented 1 year ago

I had good results using my test device (which does say nothing for the field, I know). Seeing the increase in speed, it might be worth to give it a try and fallback if it does not work. I've to say again that I only work with "esp32dev" boards having to flash any device you are likely better of not putting it in a strange state where you might loose communication.

I had do do minimal changes to the call to the esploader.js where I'm not sure why the initial change_baud call as part of main_fn does not work. Might be esploader.js needs some more love or I've to dive deeper into JS.

The change I did is applied as "patch" to esp-web-tools in this Dockerfile, see the changes here: https://github.com/openbikesensor/OpenBikeSensorFlasher/pull/25/files