Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Revision 149:24365666d28d, committed 2021-01-17
- Comitter:
- andrewboyson
- Date:
- Sun Jan 17 17:48:09 2021 +0000
- Parent:
- 148:3d685db9fdd3
- Child:
- 150:f676c14793fc
- Commit message:
- Modified firmware page to give upload progress.
Changed in this revision
--- a/base/firmware/web-firmware-script.inc Sun Jan 17 12:45:56 2021 +0000
+++ b/base/firmware/web-firmware-script.inc Sun Jan 17 17:48:09 2021 +0000
@@ -22,19 +22,23 @@
"{\n"
" logUpload('Upload error');\n"
"}\n"
+"function xhrUploadProgress(e)\n"
+"{\n"
+" logUpload('Uploading ' + e.total + ' bytes; ' + e.loaded + ' bytes so far...');\n"
+"}\n"
"function xhrUploadStart()\n"
"{\n"
-" logUpload('Uploading...');\n"
+" logUpload('Upload starting...');\n"
" \n"
" xhr = new XMLHttpRequest();\n"
"\n"
" xhr.onload = xhrUploadOnLoad;\n"
" xhr.onerror = xhrUploadOnError;\n"
+" xhr.upload.onprogress = xhrUploadProgress;\n"
"\n"
" xhr.open('POST', '/firmware-ajax'); //Defaults to async=true\n"
" xhr.send(file);\n"
"}\n"
-"\n"
"function startUpload()\n"
"{\n"
" var fileInput = document.getElementById('fileInput');\n"
@@ -85,4 +89,5 @@
"{\n"
" xhrRestartStart();\n"
"}\n"
+"\n"
""
\ No newline at end of file
--- a/base/firmware/web-firmware-script.js Sun Jan 17 12:45:56 2021 +0000
+++ b/base/firmware/web-firmware-script.js Sun Jan 17 17:48:09 2021 +0000
@@ -22,19 +22,23 @@
{
logUpload('Upload error');
}
+function xhrUploadProgress(e)
+{
+ logUpload('Uploading ' + e.total + ' bytes; ' + e.loaded + ' bytes so far...');
+}
function xhrUploadStart()
{
- logUpload('Uploading...');
+ logUpload('Upload starting...');
xhr = new XMLHttpRequest();
xhr.onload = xhrUploadOnLoad;
xhr.onerror = xhrUploadOnError;
+ xhr.upload.onprogress = xhrUploadProgress;
xhr.open('POST', '/firmware-ajax'); //Defaults to async=true
xhr.send(file);
}
-
function startUpload()
{
var fileInput = document.getElementById('fileInput');