working ish slow OTA

This commit is contained in:
Siwat Sirichai 2024-01-15 21:12:02 +07:00
parent 0b1ca17351
commit 6686c1bfe0
5 changed files with 306 additions and 283 deletions

View file

@ -31,7 +31,7 @@
reader.onload = function (e) {
var data = new Uint8Array(e.target.result);
var size = data.length;
var chunkSize = 4096;
var chunkSize = 128;
var index = 0;
$.ajax({
@ -52,6 +52,10 @@
contentType: 'application/json',
success: function () {
index += chunkSize;
// Update the progress bar
var percent = Math.floor(index / size * 100);
$('#bar').css('width', percent + '%');
$('#prg').html("Uploading: " + percent + ' (' + index + '/' + size + ')');
sendNextChunk();
}
});