Skip to content

Read from read loop remove generator logic#228

Merged
brianignacio5 merged 6 commits intomainfrom
enhance/readFromSerial
Jan 15, 2026
Merged

Read from read loop remove generator logic#228
brianignacio5 merged 6 commits intomainfrom
enhance/readFromSerial

Conversation

@brianignacio5
Copy link
Collaborator

Fix #224

Description

Using yield and async generator is not efficient logic for reading the serial port.

This PR introduces readloop as an always reading to a buffer and SLIP parsing from buffer. Seems to be more reliable.

This pull request refactors the serial communication logic to simplify data reading and improve reliability. The main changes focus on removing asynchronous generators in favor of simpler async functions, introducing a new sleep utility, and enhancing debugging and buffer management. The updates affect both the esploader.ts and webserial.ts files, resulting in more maintainable and understandable code.

Serial Communication Refactor:

  • Replaced the asynchronous generator-based read logic in Transport with a simpler async function, removing newRead and generator-based readLoop. The new read method now waits for data with a timeout and processes available bytes in a straightforward loop. (src/webserial.ts) [1] [2]
  • Updated all usages of transport.read().next() and transport.newRead() in ESPLoader to use the new transport.read() interface, simplifying packet reading and improving consistency. (src/esploader.ts) [1] [2] [3] [4]

Utility and Buffer Management:

  • Added a new sleep utility function in util.ts and replaced all internal _sleep usages with this shared function. (src/util.ts, src/esploader.ts, src/webserial.ts) [1] [2] [3] [4]
  • Added a peek() method to Transport for safely inspecting the buffer contents without consuming data, improving boot log detection logic. (src/webserial.ts, src/esploader.ts) [1] [2]

Debugging and Logging Enhancements:

  • Added detailed debug logs for register reads and boot/download mode detection to aid troubleshooting and development. (src/esploader.ts) [1] [2]

Bug Fixes and Logic Improvements:

  • Improved SLIP packet parsing: after a packet is found, any remaining bytes are now correctly preserved in the buffer for future reads. (src/webserial.ts) [1] [2] [3]
  • Updated regular expression for boot log detection to more reliably match multiline logs. (src/esploader.ts)

These changes collectively make the serial communication code easier to understand, more robust, and better suited for debugging and extension.

Testing

Manual testing using examples/typescript commands.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@brianignacio5 brianignacio5 self-assigned this Dec 12, 2025
@brianignacio5 brianignacio5 added the enhancement New feature or request label Dec 12, 2025
@github-actions
Copy link

github-actions bot commented Dec 12, 2025

Download the artifacts for this pull request:

@terrafirma2021
Copy link

can confirm fixed on Chrome Version 143.0.7499.110

@tyeth
Copy link

tyeth commented Dec 16, 2025

yeah seems fine on an s2 with same chrome version win11.
Haven't got another board with me to test, but will verify one of the older ones later (don't wait on me).
The connect button doesn't function after a failed attempt (initial connection from tinyusb msc+serial mode). However if you connect the console after the failure and then stop it, then connect program button functions again. The error situation needs cleanup on the transport/serial port.

@MitchBradley
Copy link
Contributor

I tried this patch on my problem ESP32-S3. Unfortunately, it does not work. The failure is that the code fails to detect the S3s entry to Waiting for download state, even though the S3 really did enter that state and issued the appropriate message. Then the serial port gets a bunch of Buffer Overflows and never recovers. I think it is a race condition between the serial port setup and the timing of the messages.

This branch https://github.com/MitchBradley/esptool-js/tree/timedRead works with all of the ESP32s and ESP32-S3s that I have tested so far.

Every read goes through a low-level "timedRead()" function whose timeout ensures that the reader cannot stay locked forever. It retries all possible non-fatal errors that cause the loss of the reader, by getting a new reader per the example code in core WebSerial documentation. Fatal errors that cannot be recovered cause a throw.

The SLIP reader and a new "readLine(timeout)" function are built on top of a buffering layer that sits above timedRead(). readLine() is used for parsing/detecting the entry to download mode, thus avoiding a regex that spans multiple lines, and avoiding the possible race condition when those initial bytes were read all at once.

@brianignacio5
Copy link
Collaborator Author

brianignacio5 commented Dec 17, 2025

Hi @MitchBradley Could you share which board are you using ? Using ESP32-S3-DevKitC-1 seems to work for me with this branch but maybe 3rd party boards would work differently. Also does it happen when using baud rate 115200 ?

Your approach is closer to the previous implementation without async generators which is cool but I have no way to test these changes unfortunately as I can't reproduce myself with Espressif boards.

@MitchBradley MitchBradley mentioned this pull request Dec 19, 2025
6 tasks
@brentru
Copy link

brentru commented Jan 7, 2026

@brianignacio5 Do you need any testing of this PR to help it move along? Without this merged, we are seeing reliability issues with Esptool-js.

@brianignacio5 brianignacio5 force-pushed the enhance/readFromSerial branch from 1d31e27 to 377281e Compare January 8, 2026 10:47
@brianignacio5
Copy link
Collaborator Author

Hi @brentru Yes I would appreciate someone testing this PR, since it is just me pushing these changes to the repository.

@brentru
Copy link

brentru commented Jan 8, 2026

@brianignacio5 Okay, @tyeth or I can take a look at this next week

@tyeth
Copy link

tyeth commented Jan 14, 2026

Appears to resolve the HuzzahV1 installer issue we were seeing, where it stalled on Loading esptool stub (at 115k baud) Win11.

@tyeth
Copy link

tyeth commented Jan 14, 2026

A new error was encountered, during the write, Failed to write compressed data to flash after seq 46 failed with status 201,0
image
Could be related to #226

Details with debug trace - failed at 75% of first file write (always seq 46)

TRACE 105122.000 Received full packet: 01110200000000000000
littlefs_installers.js:51 Debug: Write loop 0 45 62
littlefs_installers.js:51 Writing at 0x18ea68... (74%)
littlefs_installers.js:51 Debug: flash_defl_block bb 9d
littlefs_installers.js:51 Debug: check_command write compressed data to flash after seq 45
bundle.js:2 TRACE 105156.000 command op:0x11 data len=16400 wait_response=1 timeout=3.000 data=
    004000002d000000 0000000000000000 | .@..-...........
    bb9d403623f1fa3e 7b97a6eb760bc441 | ..@6#..>{...v..A
    1d16e3fee2342a30 8f74bb419be900d8 | .....4*0.t.A....
    79265cef0dd0b25e 2c237a82f1dca2e8 | y&\....^,#z.....
    6e8c1f573b79c8c3 cda702d8b7559af1 | n..W;y.......U..
    8434fd08bfc8fc63 861acdd75d8c711c | .4.....c....].q.
    ce78871b92d08670 7d26e5e79020066a | .x.....p}&... .j
    5c424582e3867155 85b01a37aa1a5a9a | \BE...qU...7..Z.
    4af6e0e2c2d0fa6f c6b5fe02c00b28d2 | J......o......(.
    30e43b58842ffa44 1fcdf12b3916ce26 | 0.;X./.D...+9..&
    ee78897861861940 08e32895738f9103 | .x.xa..@..(.s...
    c8ac728404c02eb9 5858fbc63a77f8c0 | ..r.....XX..:w..
    ca009fb5c0b116c2 616a00260485b549 | ........aj.&...I
    f472c016889d7d2a 21f177d96b285c9f | .r....}*!.w.k(\.
    9b608a0b3102dde7 105d3f013e49f463 | .`..1....]?.>I.c
    1167e3b8a32fe118 02d757449c473eaa | .g.../....WD.G>.
    4f388678f1afc710 9b8ec48dad9fd969 | O8.x...........i
    8b62506d1283e3cb 618f834488cfe0b4 | .bPm....a..D....
    31e184b0e013179c 550ed8915c953395 | 1.......U...\.3.
    fb02a413f416db44 24df86b3cb32637d | .......D$....2c}
    68b6773c4539551f 15c79ac071a49e70 | h.w<E9U.....q..p
    2b449f43df4d52fa 6eb7ae1a22fbf289 | +D.C.MR.n..."...
    850d78f593c0e2ea f71a2cf1b6a20253 | ..x.......,....S
    1098b0ab8de37bc6 f455aa1615ba97e3 | ......{..U......
    124da0d7364422d4 565145aff8b6b524 | .M..6D".VQE....$
    1d0ba3c552128877 b3df6976d31cec31 | ....R..w..iv...1
    63f4e49053776be6 b41b72d63152c7bb | c...Swk...r.1R..
    c42d633e44a4f9e0 5215f31ff7bba7e0 | .-c>D...R.......
    2d85ad0f7e857ce1 7bcf20661c468cc6 | -...~.|.{. f.F..
    4e63e473f67afc0b 463c8c70d1c8877e | Nc.s.z..F<.p...~
    00e75f6bf8379e93 af82d429d71a0e0a | .._k.7.....)....
    6203a2c557e7285f effa2f43bad5276e | b...W.(_../C..'n
    ba6acecade60fe6a 319959812b24c342 | .j...`.j1.Y.+$.B
    8114dda64a2bb105 75dc3953a9f8702f | ....J+..u.9S..p/
    2fd15cdad37ac573 75b16ecfa8c2d9b4 | /.\..z.su.n.....
    12104228687d0dee 8e94d3aec3a2d8c8 | ..B(h}..........
    48336ae7c07203ea 3e7966d3d2222f50 | H3j..r..>yf.."/P
    912f54913919389c d8145c21c7bd5474 | ./T.9.8...\!..Tt
    0d2dc6de50be2594 5f661ae9881e0fc3 | .-..P.%._f......
    69747ac35579b057 1890fd819f4045ba | itz.Uy.W.....@E.
    9e06e2a97390e80c d72815d891ad79d4 | ....s....(....y.
    41987cb5ce6e020c de3174be338afef4 | A.|..n...1t.3...
    1239eaa1410e40b1 87c5126078d48843 | .9..A.@....`x..C
    05b4acf978c7b674 fa67a77ff2c5478a | ....x..t.g....G.
    d1959f096c95bd00 382145f84961864b | ....l...8!E.Ia.K
    b3d5bdc13bc3cdea da345a9ade6cb513 | ....;....4Z..l..
    4d2543ff97c3ea80 506bc01c21565741 | M%C.....Pk..!VWA
    bb7c1582e3477535 b1dbfc3702c4c26e | .|...Gu5...7...n
    52ede815f1116ad1 3a8f8f44d8796c38 | R.....j.:..D.yl8
    583e0a195e6b604f edda127a25c1a35c | X>..^k`O...z%..\
    9ef78384945ad176 5cbe52d4fd76ac52 | .....Z.v\.R..v.R
    884f57eca4a028d5 a455be429f882d18 | .OW...(..U.B..-.
    a350c39a6fb6e856 3137cfc9219c72a5 | .P..o..V17..!.r.
    857396219c775a61 b63b66c3034e103f | .s.!.wZa.;f..N.?
    2c23fd3315e10b5f 13a568a572262f09 | ,#.3..._..h.r&/.
    525f3814032a9dc6 dd7d42284f1cecde | R_8..*...}B(O...
    a7e193b7f0e7627c 201168313e924ecd | ......b| .h1>.N.
    e65a973890addc25 8478eacb5925faf6 | .Z.8...%.x..Y%..
    67c8cba459afe5db 867f5ccd9b770d62 | g...Y.....\..w.b
    426d8d7780e8359c 12da113b69200149 | Bm.w..5....;i .I
    df611c0ab25da0be e3f3252edf4f8d19 | .a...]....%..O..
    63f68ee8e86aec0a 0e2e99b040e0889a | c....j......@...
    2f0023cd19f3552a 5f72b01463be6eaa | /.#...U*_r..c.n.
    f922c61dae55e4f0 567c627e4e9c18f1 | ."...U..V|b~N...
    e07d3531e02cfbe5 65d9435b694781b3 | .}51.,..e.C[iG..
    7d07ffe8dcb89f66 bb5f4e8a419d64e7 | }......f._N.A.d.
    8db475d6bd6d09ee 50dbdece1c5b5d10 | ..u..m..P....[].
    3635737ea0fc63f7 7d1a635b9a05a359 | 65s~..c.}.c[...Y
    9881c80394f70fe4 759520ef1f465e57 | ........u. ..F^W
    a1c57728599777ac e1bc7dc8fc8421e8 | ..w(Y.w...}...!.
    93cc01490618ee6d 464aea761d0a67bb | ...I...mFJ.v..g.
    83aea6944a06ca2b 5e49cf2082791081 | ....J..+^I. .y..
    b8b0713dcd48e850 7c3b05fc9d82977c | ..q=.H.P|;.....|
    a844ecdb7216f77b 161245357b502525 | .D..r..{..E5{P%
    713b0293af69db21 84ecea852e2907ed | q;...i.!.....)..
    41e71a311d32edcc ca7121151397df40 | A..1.2...q!....@
    b4cfe10c7ecee6e7 642d43dff106a7f5 | ....~...d-C.....
    acf32c350659e820 6991e15815697e80 | ..,5.Y. i..X.i~.
    c8e1b6f07a37e7af 96f375494aab9a94 | ....z7....uIJ...
    f3353fd1f64ef3b2 4a23b6e628f2dacc | .5?..N..J#..(...
    e30ac148d35468e6 391500b31c8ad6a5 | ...H.Th.9.......
    d33451a11647638d 379188d2e4ebbd9e | .4Q..Gc.7.......
    8a53b207717754a8 f10d9a5df49d168f | .S..qwT....]....
    5a609dd51fcefe42 20f07aaf184fa629 | Z`.....B .z..O.)
    59afe2ad4e5bbd22 e2f95abccc39fc0e | Y...N[."..Z..9..
    cecc6f3a683ed634 d05e5b05a318bb98 | ..o:h>.4.^[.....
    def5350feca
bundle.js:2 TRACE 105163.000 Write 16543 bytes: 
    c0001110402d0000 00004000002d0000 | ....@-....@..-..
    0000000000000000 00bb9d403623f1fa | ...........@6#..
    3e7b97a6eb760bc4 411d16e3fee2342a | >{...v..A.....4*
    308f74bb419be900 d879265cef0dd0b2 | 0.t.A....y&\....
    5e2c237a82f1dca2 e86e8c1f573b79c8 | ^,#z.....n..W;y.
    c3cda702d8b7559a f18434fd08bfc8fc | ......U...4.....
    63861acdd75d8c71 1cce78871b92d086 | c....].q..x.....
    707d26e5e7902006 6a5c424582e38671 | p}&... .j\BE...q
    5585b01a37aa1a5a 9a4af6e0e2c2d0fa | U...7..Z.J......
    6fc6b5fe02dbdc0b 28d230e43b58842f | o.......(.0.;X./
    fa441fcdf12b3916 ce26ee7889786186 | .D...+9..&.x.xa.
    194008e32895738f 9103c8ac728404db | .@..(.s.....r...
    dc2eb95858fbc63a 77f8dbdcca009fb5 | ...XX..:w.......
    dbdcb116c2616a00 260485b549f472db | .....aj.&...I.r.
    dc16889d7d2a21f1 77d96b285c9f9b60 | ....}*!.w.k(\..`
    8a0b3102dde7105d 3f013e49f4631167 | ..1....]?.>I.c.g
    e3b8a32fe11802d7 57449c473eaa4f38 | .../....WD.G>.O8
    8678f1afc7109b8e c48dad9fd9698b62 | .x...........i.b
    506d1283e3cb618f 834488cfe0b431e1 | Pm....a..D....1.
    84b0e013179c550e d8915c953395fb02 | ......U...\.3...
    a413f416dbdd4424 df86b3cb32637d68 | ......D$....2c}h
    b6773c4539551f15 c79adbdc71a49e70 | .w<E9U......q..p
    2b449f43df4d52fa 6eb7ae1a22fbf289 | +D.C.MR.n..."...
    850d78f593dbdce2 eaf71a2cf1b6a202 | ..x........,....
    531098b0ab8de37b c6f455aa1615ba97 | S......{..U.....
    e3124da0d7364422 d4565145aff8b6b5 | ..M..6D".VQE....
    241d0ba3c5521288 77b3df6976d31cec | $....R..w..iv...
    3163f4e49053776b e6b41b72d63152c7 | 1c...Swk...r.1R.
    bbc42d633e44a4f9 e05215f31ff7bba7 | ..-c>D...R......
    e02d85ad0f7e857c e17bcf20661c468c | .-...~.|.{. f.F.
    c64e63e473f67afc 0b463c8c70d1c887 | .Nc.s.z..F<.p...
    7e00e75f6bf8379e 93af82d429d71a0e | ~.._k.7.....)...
    0a6203a2c557e728 5feffa2f43bad527 | .b...W.(_../C..'
    6eba6acecade60fe 6a319959812b24c3 | n.j...`.j1.Y.+$.
    428114dda64a2bb1 0575dc3953a9f870 | B....J+..u.9S..p
    2f2fd15cdad37ac5 7375b16ecfa8c2d9 | //.\..z.su.n....
    b412104228687d0d ee8e94d3aec3a2d8 | ...B(h}.........
    c848336ae7dbdc72 03ea3e7966d3d222 | .H3j...r..>yf.."
    2f50912f54913919 389cd8145c21c7bd | /P./T.9.8...\!..
    54740d2dc6de50be 25945f661ae9881e | Tt.-..P.%._f....
    0fc369747ac35579 b0571890fd819f40 | ..itz.Uy.W.....@
    45ba9e06e2a97390 e80cd72815d891ad | E.....s....(....
    79d441987cb5ce6e 020cde3174be338a | y.A.|..n...1t.3.
    fef41239eaa1410e 40b187c5126078d4 | ...9..A.@....`x.
    884305b4acf978c7 b674fa67a77ff2c5 | .C....x..t.g....
    478ad1959f096c95 bd00382145f84961 | G.....l...8!E.Ia
    864bb3d5bdc13bc3 cdeada345a9ade6c | .K....;....4Z..l
    b5134d2543ff97c3 ea80506bdbdc1c21 | ..M%C.....Pk...!
    565741bb7c1582e3 477535b1dbddfc37 | VWA.|...Gu5....7
    02c4c26e52ede815 f1116ad13a8f8f44 | ...nR.....j.:..D
    d8796c38583e0a19 5e6b604fedda127a | .yl8X>..^k`O...z
    25c1a35c9ef78384 945ad1765cbe52d4 | %..\.....Z.v\.R.
    fd76ac52884f57ec a4a028d5a455be42 | .v.R.OW...(..U.B
    9f882d18a350c39a 6fb6e8563137cfc9 | ..-..P..o..V17..
    219c72a585739621 9c775a61b63b66c3 | !.r..s.!.wZa.;f.
    034e103f2c23fd33 15e10b5f13a568a5 | .N.?,#.3..._..h.
    72262f09525f3814 032a9dc6dd7d4228 | r&/.R_8..*...}B(
    4f1cecdea7e193b7 f0e7627c20116831 | O.........b| .h1
    3e924ecde65a9738 90addc258478eacb | >.N..Z.8...%.x..
    5925faf667c8cba4 59afe5dbdd867f5c | Y%..g...Y......\
    cd9b770d62426d8d 7780e8359c12da11 | ..w.bBm.w..5....
    3b69200149df611c 0ab25da0bee3f325 | ;i .I.a...]....%
    2edf4f8d1963f68e e8e86aec0a0e2e99 | ..O..c....j.....
    b040e0889a2f0023 cd19f3552a5f72b0 | .@.../.#...U*_r.
    1463be6eaaf922c6 1dae55e4f0567c62 | .c.n.."...U..V|b
    7e4e9c18f1e07d35 31e02cfbe565d943 | ~N....}51.,..e.C
    5b694781b37d07ff e8dcb89f66bb5f4e | [iG..}......f._N
    8a419d64e78db475 d6bd6d09ee50dbdd | .A.d...u..m..P..
    dece1c5b5d103635 737ea0fc63f77d1a | ...[].65s~..c.}.
    635b9a05a3599881 c80394f70fe47595 | c[...Y........u.
    20ef1f465e57a1c5 7728599777ace1bc |  ..F^W..w(Y.w...
    7dc8fc8421e893cc 01490618ee6d464a | }...!....I...mFJ
    ea761d0a67bb83ae a6944a06ca2b5e49 | .v..g.....J..+^I
    cf2082791081b8b0 713dcd48e8507c3b | . .y....q=.H.P|;
    05fc9d82977ca844 ecdbdd7216f77b16 | .....|.D...r..{.
    1245357b50252571 3b0293af69dbdd21 | .E5{P%q;...i..!
    84ecea852e2907ed 41e71a311d32edcc | .....)..A..1.2..
    ca7121151397df40 b4cfe10c7ecee6e7 | .q!....@....~...
    642d43dff106a7f5 acf32c350659e820 | d-C.......,5.Y. 
    6991e15815697e80 c8e1b6f07a37e7af | i..X.i~.....z7..
    96f375494aab9a94 f3353fd1f64ef3b2 | ..uIJ....5?..N..
    4a23b6e628f2dacc e30ac148d35468e6 | J#..(......H.Th.
    391500b31c8ad6a5 d33451a11647638d | 9........4Q..Gc.
    379188d2e4ebbd9e 8a53b207717754a8 | 7........S..qwT.
    f10d9a5df49d168f 5a609dd51fcefe42 | ...]....Z`.....B
    20f07aaf184fa629 59afe2ad4e5bbd22 |  .z..O.)Y...N[."
    e2f95abccc39fc0e cecc6f3a683ed634 | ..Z..9....o:h>.4
    d
bundle.js:2 TRACE 106604.000 Read 12 bytes: c001110200000000000000c0
bundle.js:2 TRACE 106604.000 Received full packet: 01110200000000000000
littlefs_installers.js:51 Debug: Write loop 0 46 62
littlefs_installers.js:51 Writing at 0x19598b... (75%)
littlefs_installers.js:51 Debug: flash_defl_block a4 89
littlefs_installers.js:51 Debug: check_command write compressed data to flash after seq 46
bundle.js:2 TRACE 106637.000 command op:0x11 data len=16400 wait_response=1 timeout=3.000 data=
    004000002e000000 0000000000000000 | .@..............
    a48900395603d978 b05d5ebbdc305583 | ...9V..x.]^..0U.
    5f34c2567940dae0 986d1f7584645ba1 | _4.Vy@...m.u.d[.
    93f650bc38603bdc 24ca6d6d76f9b25c | ..P.8`;.$.mmv..\
    32659aa29c096678 bbde85fa97e40fcf | 2e....fx........
    53bf12134d70d797 858b9ec57c2b83ab | S...Mp......|+..
    f82b314748c27d86 46c1c5536e361ac1 | .+1GH.}.F..Sn6..
    60a014f7ba005cb7 591a090cdb28b077 | `.....\.Y....(.w
    37c1446023643994 895e96255320a7c6 | 7.D`#d9..^.%S ..
    4dfe86620f453cf1 723955f0c6f6424c | M..b.E<.r9U...BL
    f8d639a0e7108aef aa5a324a283d5fa3 | ..9......Z2J(=_.
    a23b5fb649ee8493 6250fad4e4c8ff9e | .;_.I...bP......
    02b1f0cb68c6eb64 fed9a2912b62995a | ....h..d....+b.Z
    1c83b9f8533117df 2091ffcd580ca37d | ....S1.. ...X..}
    9daafe3c8123eb86 2bb5fcf6eb04f24d | ...<.#..+......M
    6f8fd0dbd77dc46f f7055d10cdd47c87 | o....}.o..]...|.
    3579f88513a2656b a98e991402dae851 | 5y....ek.......Q
    56e492848025dc73 28bcbf670fadb540 | V....%.s(..g...@
    3e6b3e51b8456156 fd1954ecd1c569a1 | >k>Q.EaV..T...i.
    6792aaeaddfecbaa 7a49251f71adc5c5 | g.......zI%.q...
    86b3301dff163fb1 d9ef514420de972f | ..0...?...QD ../
    d78ee47d6fd37758 bcaf1eaffcdf78df | ...}o.wX......x.
    7b107b99f9e12288 2aee5700cbf157e5 | {.{...".*.W...W.
    d3b0213b9aa0b406 e8d9406b3378400e | ..!;......@k3x@.
    8cb8e5e000abcb75 1b61969cc01fc8b0 | .......u.a......
    753522700159a4f5 b932498712faa9b8 | u5"p.Y...2I.....
    2d0a741e54b2e5c7 73313ff5f149ab03 | -.t.T...s1?..I..
    65b73fe4f2900800 ff4e8c8565ee6b5f | e.?......N..e.k_
    c5bdbb8a2341325a 4f06f7ae54d15016 | ....#A2ZO...T.P.
    19ab54804bbb8f84 4e6477fe130464c4 | ..T.K...Ndw...d.
    714c301c81818f38 349642d555dba8c8 | qL0....84.B.U...
    3e8ecb8019dc7e2f 8db425a42dc120ae | >.....~/..%.-. .
    52e8712015bc5235 f11baaa49198e0d9 | R.q ..R5........
    bf9860d2a9b69659 8567dabb92bf2a1f | ..`....Y.g....*.
    9e2636b854f162bb ee3f45eff632379a | .&6.T.b..?E..27.
    dfb45e4976533013 af254a891739f112 | ..^IvS0..%J..9..
    8df955f4fae09fc4 cf539c422ceec2c5 | ..U......S.B,...
    fa1dc74ed6ef2882 27fc1e5ce2358eda | ...N..(.'..\.5..
    fa7418c966b5e069 b25ab05bcc35984a | .t..f..i.Z.[.5.J
    85223b4d4f188940 3ca3b8d49fe0298e | .";MO..@<.....).
    f3d72de201cc1e76 86c5cf4ee86f7fdf | ..-....v...N.o..
    d1911348adafad3d 6de0c36fbedf42aa | ...H...=m..o..B.
    dbbe9d30dae8000a 812ba65c0aaae16a | ...0.....+.\...j
    d38c5dc4afdfaca8 77548a1f6006c733 | ..].....wT..`..3
    49e49723296e18a2 37ae68dd5414833a | I..#)n..7.h.T..:
    56738a6280665cdb 6a8ff020f2564973 | Vs.b.f\.j.. .VIs
    c4a3f9357dec0158 88cf2505c051f43b | ...5}..X..%..Q.;
    7ec40485bc8ef347 9c91a45c881b7d1f | ~......G...\..}.
    cda843a6fa2c7476 6ccbb254256b44b6 | ..C..,tvl..T%kD.
    92190fc65c5c5614 5bb8c55d7f850a90 | ....\\V.[..]....
    540c914c06f7acba 95b24a247d88d99c | T..L......J$}...
    a2d446437f4787fe ce54221c41ebfd72 | ..FC.G...T".A..r
    3d059f0461a82951 60b3fdf0abc4cf38 | =...a.)Q`......8
    9bf8452ea2fe6622 53fea0d7e507c190 | ..E...f"S.......
    4d81be3d27906d0b 96b8412ca932cecf | M..='.m...A,.2..
    159b442639971823 02d326d4bd7baf12 | ..D&9..#..&..{..
    fc1964f37f45f0fd ffdf08feefc95fe2 | ..d..E........_.
    81bb098247e6fc9c 4b018e897bbe6f68 | ....G...K...{.oh
    2ff41f57848efc73 881d3603cd0d6ee9 | /..W...s..6...n.
    6698a30d31bf0b99 182933c9f4dede8c | f...1....)3.....
    1fa7a360c4fb6833 f1cafbf19b37d85f | ...`..h3.....7._
    5e1cc58dbc36e243 3ac603d04703c07c | ^....6.C:...G..|
    0c979db9beae1166 2a1be8fb290b50b3 | .......f*...).P.
    bc15d09383e7b8d2 6a23c32b051c0c5f | ........j#.+..._
    17973cd410972796 3569a4f802985323 | ..<...'.5i....S#
    dc53c99356cd23fc e65f8df0c97ca952 | .S..V.#.._...|.R
    be32c2926daa4faf de1a5fec6fbf4a2a | .2..m.O..._.o.J*
    c562583cf7c3eff8 d211e29328d34e9b | .bX<........(.N.
    bcf5d29eb1069ee2 ce9bc660e0f2638a | ...........`..c.
    ad9adc091bd86779 14e97f91ed50efeb | ......gy.....P..
    fe553073563c1737 1dacfd3b03ba2c3d | .U0sV<.7...;..,=
    609a1b60dc230523 1859c70b88201497 | `..`.#.#.Y... ..
    bd62cab92feeff2b cee6c8012da08a78 | .b../..+....-..x
    c79b75feff6b365d 368b6d7dabfb3361 | ..u..k6]6.m}..3a
    36a08b810f43a858 4b00122a2818d229 | 6....C.XK..*(..)
    d3ad4d9c83e920ea 8aa8f65d73c1b92c | ..M... ....]s..,
    3b03aae2990786a7 63f56a3c934d1eba | ;.......c.j<.M..
    2523b3360043667d 4a221cd6afa15c7a | %#.6.Cf}J"....\z
    07a60d7123e0549a d676e2d036df3ab7 | ...q#.T..v..6.:.
    611a701365c97faf 971226ca658fcd7a | a.p.e.....&.e..z
    6fb92e5bf398f5a9 e59966bdf152bb8d | o..[......f..R..
    4ebfb80ad3a1a255 30ae5b754e51a47f | N......U0.[uNQ..
    62c05cb003a69212 7548c6e8589d8e67 | b.\.....uH..X..g
    1fe045bc1014bfe8 5df59ca5558572af | ..E.....]...U.r.
    9e94439db0f1d5e1 ee3bdd821bdf7490 | ..C......;....t.
    10169dc1c255321e 6c08a691a0614a8c | .....U2.l....aJ.
    04612437e0
bundle.js:2 TRACE 106644.000 Write 16512 bytes: 
    c000111040740000 00004000002e0000 | ....@t....@.....
    0000000000000000 00a48900395603d9 | ............9V..
    78b05d5ebbdc3055 835f34c2567940da | x.]^..0U._4.Vy@.
    e0986d1f7584645b a193f650bc38603b | ..m.u.d[...P.8`;
    dc24ca6d6d76f9b2 5c32659aa29c0966 | .$.mmv..\2e....f
    78bbde85fa97e40f cf53bf12134d70d7 | x........S...Mp.
    97858b9ec57c2b83 abf82b314748c27d | .....|+...+1GH.}
    8646c1c5536e361a c160a014f7ba005c | .F..Sn6..`.....\
    b7591a090cdbdd28 b07737c144602364 | .Y.....(.w7.D`#d
    3994895e96255320 a7c64dfe86620f45 | 9..^.%S ..M..b.E
    3cf1723955f0c6f6 424cf8d639a0e710 | <.r9U...BL..9...
    8aefaa5a324a283d 5fa3a23b5fb649ee | ...Z2J(=_..;_.I.
    84936250fad4e4c8 ff9e02b1f0cb68c6 | ..bP..........h.
    eb64fed9a2912b62 995a1c83b9f85331 | .d....+b.Z....S1
    17df2091ffcd580c a37d9daafe3c8123 | .. ...X..}...<.#
    eb862bb5fcf6eb04 f24d6f8fd0dbddd7 | ..+......Mo.....
    7dc46ff7055d10cd d47c873579f88513 | }.o..]...|.5y...
    a2656ba98e991402 dae85156e4928480 | .ek.......QV....
    25dc7328bcbf670f adb5403e6b3e51b8 | %.s(..g...@>k>Q.
    456156fd1954ecd1 c569a16792aaeadd | EaV..T...i.g....
    fecbaa7a49251f71 adc5c586b3301dff | ...zI%.q.....0..
    163fb1d9ef514420 de972fd78ee47d6f | .?...QD ../...}o
    d37758bcaf1eaffc df78df7b107b99f9 | .wX......x.{.{..
    e122882aee5700cb f157e5d3b0213b9a | .".*.W...W...!;.
    a0b406e8d9406b33 78400e8cb8e5e000 | .....@k3x@......
    abcb751b61969cdb dc1fc8b075352270 | ..u.a.......u5"p
    0159a4f5b9324987 12faa9b82d0a741e | .Y...2I.....-.t.
    54b2e5c773313ff5 f149ab0365b73fe4 | T...s1?..I..e.?.
    f2900800ff4e8c85 65ee6b5fc5bdbb8a | .....N..e.k_....
    2341325a4f06f7ae 54d1501619ab5480 | #A2ZO...T.P...T.
    4bbb8f844e6477fe 130464c4714c301c | K...Ndw...d.qL0.
    81818f38349642d5 55dbdda8c83e8ecb | ...84.B.U....>..
    8019dc7e2f8db425 a42dc120ae52e871 | ...~/..%.-. .R.q
    2015bc5235f11baa a49198e0d9bf9860 |  ..R5..........`
    d2a9b696598567da bb92bf2a1f9e2636 | ....Y.g....*..&6
    b854f162bbee3f45 eff632379adfb45e | .T.b..?E..27...^
    4976533013af254a 891739f1128df955 | IvS0..%J..9....U
    f4fae09fc4cf539c 422ceec2c5fa1dc7 | ......S.B,......
    4ed6ef288227fc1e 5ce2358edafa7418 | N..(.'..\.5...t.
    c966b5e069b25ab0 5bcc35984a85223b | .f..i.Z.[.5.J.";
    4d4f1889403ca3b8 d49fe0298ef3d72d | MO..@<.....)...-
    e201cc1e7686c5cf 4ee86f7fdfd19113 | ....v...N.o.....
    48adafad3d6de0c3 6fbedf42aadbddbe | H...=m..o..B....
    9d30dae8000a812b a65c0aaae16ad38c | .0.....+.\...j..
    5dc4afdfaca87754 8a1f6006c73349e4 | ].....wT..`..3I.
    9723296e18a237ae 68dd5414833a5673 | .#)n..7.h.T..:Vs
    8a6280665cdbdd6a 8ff020f2564973c4 | .b.f\..j.. .VIs.
    a3f9357dec015888 cf2505dbdc51f43b | ..5}..X..%...Q.;
    7ec40485bc8ef347 9c91a45c881b7d1f | ~......G...\..}.
    cda843a6fa2c7476 6ccbb254256b44b6 | ..C..,tvl..T%kD.
    92190fc65c5c5614 5bb8c55d7f850a90 | ....\\V.[..]....
    540c914c06f7acba 95b24a247d88d99c | T..L......J$}...
    a2d446437f4787fe ce54221c41ebfd72 | ..FC.G...T".A..r
    3d059f0461a82951 60b3fdf0abc4cf38 | =...a.)Q`......8
    9bf8452ea2fe6622 53fea0d7e507c190 | ..E...f"S.......
    4d81be3d27906d0b 96b8412ca932cecf | M..='.m...A,.2..
    159b442639971823 02d326d4bd7baf12 | ..D&9..#..&..{..
    fc1964f37f45f0fd ffdf08feefc95fe2 | ..d..E........_.
    81bb098247e6fc9c 4b018e897bbe6f68 | ....G...K...{.oh
    2ff41f57848efc73 881d3603cd0d6ee9 | /..W...s..6...n.
    6698a30d31bf0b99 182933c9f4dede8c | f...1....)3.....
    1fa7a360c4fb6833 f1cafbf19b37d85f | ...`..h3.....7._
    5e1cc58dbc36e243 3ac603d04703dbdc | ^....6.C:...G...
    7c0c979db9beae11 662a1be8fb290b50 | |.......f*...).P
    b3bc15d09383e7b8 d26a23c32b051c0c | .........j#.+...
    5f17973cd4109727 963569a4f8029853 | _..<...'.5i....S
    23dc53c99356cd23 fce65f8df0c97ca9 | #.S..V.#.._...|.
    52be32c2926daa4f afde1a5fec6fbf4a | R.2..m.O..._.o.J
    2ac562583cf7c3ef f8d211e29328d34e | *.bX<........(.N
    9bbcf5d29eb1069e e2ce9bc660e0f263 | ............`..c
    8aad9adc091bd867 7914e97f91ed50ef | .......gy.....P.
    ebfe553073563c17 371dacfd3b03ba2c | ..U0sV<.7...;..,
    3d609a1b60dc2305 231859c70b882014 | =`..`.#.#.Y... .
    97bd62cab92feeff 2bcee6c8012da08a | ..b../..+....-..
    78c79b75feff6b36 5d368b6d7dabfb33 | x..u..k6]6.m}..3
    6136a08b810f43a8 584b00122a2818d2 | a6....C.XK..*(..
    29d3ad4d9c83e920 ea8aa8f65d73c1b9 | )..M... ....]s..
    2c3b03aae2990786 a763f56a3c934d1e | ,;.......c.j<.M.
    ba2523b336004366 7d4a221cd6afa15c | .%#.6.Cf}J"....\
    7a07a60d7123e054 9ad676e2d036df3a | z...q#.T..v..6.:
    b7611a701365c97f af971226ca658fcd | .a.p.e.....&.e..
    7a6fb92e5bf398f5 a9e59966bdf152bb | zo..[......f..R.
    8d4ebfb80ad3a1a2 5530ae5b754e51a4 | .N......U0.[uNQ.
    7f62dbdc5cb003a6 92127548c6e8589d | .b..\.....uH..X.
    8e671fe045bc1014 bfe85df59ca55585 | .g..E.....]...U.
    72af9e94439db0f1 d5e1ee3bdd821bdf | r...C......;....
    749010169dc1c255 321e6c08a691a061 | t......U2.l....a
    
bundle.js:2 TRACE 108080.000 Read 9 bytes: c00111020000000000
bundle.js:2 TRACE 108085.000 Read 3 bytes: c900c0          
bundle.js:2 TRACE 108085.000 Received full packet: 0111020000000000c900
installHook.js:1 A: Failed to write compressed data to flash after seq 46 failed with status 201,0
    at Ai.checkCommand (bundle.js:2:81600)
    at async Ai.flashDeflBlock (bundle.js:2:85853)
    at async Ai.writeFlash (bundle.js:2:95656)
    at async installViaWebserial (littlefs_installers.js:214:5)
    at async startProcess (FirmwareProcess.jsx:86:11)

@tyeth
Copy link

tyeth commented Jan 14, 2026

A new error was encountered, during the write, Failed to write compressed data to flash after seq 46 failed with status 201,0 image Could be related to #226

Details with debug trace - failed at 75% of first file write (always seq 46)

Appears resolved after changing our file firmware formats (passing through esploader.bstrToUi8) and updating the calculateMD5Hash function in line with #226

@brentru
Copy link

brentru commented Jan 14, 2026

@tyeth So the PR is OK and @brianignacio5 can move forward with merging?

@tyeth
Copy link

tyeth commented Jan 14, 2026

@tyeth So the PR is OK and @brianignacio5 can move forward with merging?

Yeah looks good. Just the minor turbulence with the format reshuffle.

@brianignacio5 ok to release, but probably worth noting the Uint8Array and calculateMD5Hash change in release notes.

Tested on:
Feather ESP32-C6
QtPy ESP32
Feather ESP32 (huzzah v1)

@brianignacio5
Copy link
Collaborator Author

Thanks for the review @tyeth !

@brianignacio5 brianignacio5 merged commit a6b8074 into main Jan 15, 2026
1 check passed
@brianignacio5 brianignacio5 deleted the enhance/readFromSerial branch January 15, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confused about serial port generators

5 participants