Skip to content

Commit

Permalink
added guard.
Browse files Browse the repository at this point in the history
  • Loading branch information
htotoo committed Dec 28, 2024
1 parent 3f7fc08 commit 195fd7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,12 @@ <h1>ESP32 PP v0.16</h1>
gotbytes = 0;
let gotbytesAll = 0;
let concatenatedHexData = "";
// todo guard too many tries when no data arrives
while (gotbytesAll < expectedFileSize) {
//var tosend = "fread " + expectedFileSize.toString() + "\r\n";
var tosend = "fread 512\r\n";
respWaiting = PROMPT;//?!
await sendAndWait(tosend);
var beflen = concatenatedHexData.length;
concatenatedHexData += respLinestp.slice(1, -1).join('').replace(/\r\n/g, "");
if (respLinestp[respLinestp.length - 1] != "ok\r\n") {
concatenatedHexData += respLinestp[respLinestp.length - 1].replace(/\r\n/g, "");
Expand All @@ -598,6 +598,9 @@ <h1>ESP32 PP v0.16</h1>
if (progress > 100) progress = 100;
setProgress(progress);
//await new Promise(r => setTimeout(r, 150));
if (concatenatedHexData.length == beflen) {
break;
}
}
//check if i downloaded it or not
if (gotbytesAll < expectedFileSize) {
Expand Down

0 comments on commit 195fd7d

Please sign in to comment.