espressif / esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
https://espressif.github.io/esptool-js/
Apache License 2.0
251 stars 101 forks source link

Address 3 issues: baud rate change, flash reading, instantiation with port #112

Closed g3gg0 closed 8 months ago

g3gg0 commented 9 months ago

This PR adds 3 changes that made the code usable in TeddyCloud, a toniebox server implementation.

Reading flash memory

the function read_flash() allows reading back the flash

Baud rate fix

changing the baud rate did not resynchronize properly. added sync and retries. this way 921600 baud connection works always. before it worked 1 out of 30 connection attempts.

Instantiation using WebSerial port as well as Transport

simplify caller's code by directly using WebSerial port object if specified.

esploader = new ESPLoader({
  port: port,
  baudrate: 921600,
  romBaudrate: 115200
});
balloob commented 8 months ago

@igrr this change looks good. It might fix an issue we’re seeing with ESP Web Tools. Can we get this merged and released?

g3gg0 commented 8 months ago

interesting failures... ah i see. it is complaing due to formatting issues? got it.

g3gg0 commented 8 months ago

did update the code, but didn't run it yet in our project (https://github.com/toniebox-reverse-engineering/teddycloud) will do the functional checks in 1-2 days

brianignacio5 commented 8 months ago

Thanks for the PR @g3gg0 looks great !

I've tested locally with esp32 wrover kit and works good. You can test the lint locally with npm run lint and after this will merge the PR.

brianignacio5 commented 8 months ago

Closing this PR since it is merged with fixes in 04e337db44c5249016342b477a1827e6409fc31e

balloob commented 8 months ago

Thanks. Don't forget to tag the release on GitHub too.

balloob commented 8 months ago

I found a small bug in the type which I reported here https://github.com/espressif/esptool-js/commit/04e337db44c5249016342b477a1827e6409fc31e#r130045791