From 9828d6f2706459ddd7ca59f4bd6dd944d6335e68 Mon Sep 17 00:00:00 2001 From: dingo35 Date: Wed, 22 May 2024 13:54:39 +0200 Subject: [PATCH] packfs.py, index.html, update2.html: Put links on update screen for easy download --- SmartEVSE-3/data/app.js | 49 ------------ SmartEVSE-3/data/index.html | 1 + SmartEVSE-3/data/update2.html | 142 ++++++++++++++++++++++++++++++++-- SmartEVSE-3/packfs.py | 3 - 4 files changed, 138 insertions(+), 57 deletions(-) delete mode 100644 SmartEVSE-3/data/app.js diff --git a/SmartEVSE-3/data/app.js b/SmartEVSE-3/data/app.js deleted file mode 100644 index 39c75726..00000000 --- a/SmartEVSE-3/data/app.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2020 Cesanta Software Limited -// All rights reserved - -// Helper function to display upload status -var setStatus = function(text) { - document.getElementById('el3').innerText = text; -}; - -// When user clicks on a button, trigger file selection dialog -var button = document.getElementById('el2'); -button.onclick = function(ev) { - input.click(); -}; - -// Send a large blob of data chunk by chunk -var sendFileData = function(name, data, chunkSize) { - var sendChunk = function(offset) { - var chunk = data.subarray(offset, offset + chunkSize) || ''; - var opts = {method: 'POST', body: chunk}; - var url = '/update?offset=' + offset + '&file=' + encodeURIComponent(name) + '&size=' + data.length; - var ok; - if (offset + chunk.length == data.length) - setStatus('Upload of ' + name + ' finished, you can close this page.'); - else - setStatus('Uploading ' + name + ', bytes ' + offset + '..' + (offset + chunk.length) + ' of ' + data.length); - fetch(url, opts) - .then(function(res) { - if (res.ok && chunk.length > 0) sendChunk(offset + chunk.length); - ok = res.ok; - return res.text(); - }) - .then(function(text) { - if (!ok) setStatus('Error: ' + text); - }); - }; - sendChunk(0); -}; - -// If user selected a file, read it into memory and trigger sendFileData() -var input = document.getElementById('el1'); -input.onchange = function(ev) { - if (!ev.target.files[0]) return; - var f = ev.target.files[0], r = new FileReader(); - r.readAsArrayBuffer(f); - r.onload = function() { - ev.target.value = ''; - sendFileData(f.name, new Uint8Array(r.result), 20480); - }; -}; diff --git a/SmartEVSE-3/data/index.html b/SmartEVSE-3/data/index.html index f8c4bd53..26f051fd 100644 --- a/SmartEVSE-3/data/index.html +++ b/SmartEVSE-3/data/index.html @@ -36,6 +36,7 @@ if(!initiated) { initiated = true; $('#version').append(data.version); + sessionStorage.setItem("version",JSON.stringify(data.version)); $('#serialnr').append(data.serialnr); let minCurrent=parseInt(data.settings.current_min.toFixed(1)); diff --git a/SmartEVSE-3/data/update2.html b/SmartEVSE-3/data/update2.html index 70c6491a..2cfa0756 100644 --- a/SmartEVSE-3/data/update2.html +++ b/SmartEVSE-3/data/update2.html @@ -10,16 +10,62 @@ #info { background: #e0f0f0; border-radius: .5em; padding: 2em; } #wrapper { margin-top: 1em; } + - +
+ Current version: + ======================================================= + DOWNLOADING +

+ + + + + + + + + + + + + + + + + + + + + + + + +
Distribution:Status:Github repo:Latest version:Download:
Factorystable
standarddebug
Community          bleeding edge       
standarddebug
+
+ ======================================================= +
+ FLASHING +

Flash one of:
    -
  • firmware.bin (to update the firmware);
  • -
  • firmware.debug.bin (if you want to telnet to your SmartEVSE to see debug messages);
  • +
  • firmware.bin or firmware.signed.bin (to update the firmware);
  • +
  • firmware.debug.bin or firmware.debug.signed.bin (if you want to telnet to your SmartEVSE to see debug messages);
  • rfix.txt (if you want to bulk upload allowed NFC tags for the RFID reader);
-
You should only flash files with those exact names.
No need to flash spiffs.bin anymore!
No need to rename firmware.debug.bin anymore! + You should only flash files with those exact names.
No need to flash spiffs.bin for versions 3.6.0-RC1 and newer!
No need to rename firmware.debug.bin anymore for versions 3.6.0-RC2 and newer!
Signed firmware is verified to be original and can be handled by versions 3.6.1 and newer.
@@ -28,5 +74,91 @@
- + + diff --git a/SmartEVSE-3/packfs.py b/SmartEVSE-3/packfs.py index a06bdd20..8f741c6d 100644 --- a/SmartEVSE-3/packfs.py +++ b/SmartEVSE-3/packfs.py @@ -5,9 +5,6 @@ if not os.path.isfile("data/update2.html"): print("Missing file: data/update2.html") sys.exit(1) -if not os.path.isfile("data/app.js"): - print("Missing file: data/app.js") - sys.exit(2) if os.path.isdir("pack.tmp"): shutil.rmtree('pack.tmp') try: