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
288 stars 108 forks source link

Re-enable block timeout calculation #83

Closed igrr closed 1 year ago

igrr commented 1 year ago

Block write timeout is generally determined by the time it takes to erase and write the data into flash. Since that time is proportional to the amount of uncompressed data written, we need to keep track of the number of bytes each chunk is decompressed into.

Re-enable the commented out code block, based on a suggestion (from Mark Adler, no less!) in https://stackoverflow.com/a/73096372.

Testing

I've tested this by flashing a 2 MB sized empty SPIFFS image.

Without the fix, flashing times out.

With the fix, the timeout seems to be correctly calculated based on the uncompressed chunk size. With some debug logging added:

Compressed 2097152 bytes to 3825...
Debug: check_command enter compressed flash mode
Debug: Write loop 4096 0 1
Writing at 0x1000... (100%)
Debug: block compressed: 3825 uncompressed: 2097152
Debug: block timeout 83886.08
Debug: check_command write compressed data to flash after seq 0
Wrote 2097152 bytes (3825 compressed) at 0x1000 in 10.814 seconds.
balloob commented 1 year ago

Could we have a new release once this is merged? 🙏

balloob commented 1 year ago

🎉

Would you have time for a release this week?

balloob commented 1 year ago

@igrr last time I'll ask, but could we get a release with this fix? Now that the repo has been migrated to TypeScript, we can no longer point our dependency at a git commit

igrr commented 1 year ago

@balloob I am sorry for the delay! We have talked with @brianignacio5 about preparing the new release, but it seems like there is some issue in the release workflow that needs to be fixed, and neither of us has had time to look into this yet, unfortunately!

Jason2866 commented 1 year ago

@balloob release is done :-)