Browse Source

update: add help messages

Add help messages on firmware flash failure
H. Peter Anvin 2 years ago
parent
commit
5af141b7f6
7 changed files with 51 additions and 17 deletions
  1. BIN
      esp32/output/max80.ino.bin
  2. 7 0
      esp32/www/lang/sv
  3. 14 5
      esp32/www/max80.css
  4. 19 11
      esp32/www/max80.js
  5. 11 1
      esp32/www/update.html
  6. BIN
      fpga/output/v1.fw
  7. BIN
      fpga/output/v2.fw

BIN
esp32/output/max80.ino.bin


+ 7 - 0
esp32/www/lang/sv

@@ -19,3 +19,10 @@ title.update=MAX80: Uppdatera
 .notyet=(jobbar på det)
 button .show=Visa
 button .hide=Göm
+.onerr h3=Förslag till felsökning
+.onerr .retry=Försök igen
+.onerr .jtag=Se till att ingen JTAG-kabel är inkopplad
+.onerr .power=Slå av strömmer (koppla ur båda USB och stäng av ABC)
+.onerr .esp=Uppdatera ESP32 över USB och försök igen
+.onerr .serial=Se serieport för mer detaljerad status
+

+ 14 - 5
esp32/www/max80.css

@@ -120,18 +120,27 @@ progress {
 }
 output {
     display: none;
-}
-output.result {
-    display: block;
     border: 2px solid black;
     margin: 1em;
     padding: 0.75em 1.25em;
     border-radius: 1em;
     white-space: pre-wrap;
 }
-.ok {
+.ok output {
+    display: block;
     background: #e0ffe0;
 }
-.err {
+.err output {
+    display: block;
     background: #ffe0e0;
 }
+.onerr {
+    display: none;
+}
+.err .onerr {
+    display: block;
+}
+.onerr h3 {
+    text-weight: bold;
+    text-decoration: underline;
+}

+ 19 - 11
esp32/www/max80.js

@@ -11,6 +11,15 @@ function chi(me,tag) { return me.getElementsByTagName(tag)[0]; }
 // Find a sibling element with a specific tag
 function sib(me,tag) { return chi(me.parentElement, tag); }
 
+// Add/remove class entries in bulk; tags is an Array each containing
+// an Array of arguments to toggle. On return the second element of
+// each Array will be updated to the current value.
+function classmod(elem,tags) {
+    for (var i = 0; i < tags.length; i++)
+	tags[i][1] = elem.classList.toggle(tags[i]);
+    return tags;
+}
+
 // Read a key=value text file and return it as a Promise of a Map
 function fetchconfig(url) {
     return fetch(url, {redirect: "follow"})
@@ -122,25 +131,24 @@ function upload(form,data) {
 	}, PassiveListener);
     }
 
-    var result = chi(form,'output');
-    if (result)
-	result.classList.remove('result');
+    classmod(form, [['started',1],['done',0],['ok',0],['err',0],['running',1]]);
 
-    xhr.addEventListener('readystatechange', (e) => {
-	if (xhr.readyState != XMLHttpRequest.DONE)
-	    return;
+    xhr.addEventListener('loadend', (e) => {
 	const ok = xhr.status >= 200 && xhr.status < 400;
-	if (progress)
-	    progress.value = ok ? progress.max : 0;
+	if (progress && ok)
+	    progress.value = progress.max;
+
+	var result = chi(form,'output');
 	if (result) {
 	    var msg = xhr.responseText.trimEnd();
 	    if (!msg)
 		msg = xhr.status + ' ' + xhr.statusText;
 	    result.textContent = msg;
-	    result.classList.toggle('ok', ok);
-	    result.classList.toggle('err', !ok);
-	    result.classList.add('result');
 	}
+
+	classmod(form, [['ok',ok],['err',!ok],['running',0],['done',1]]);
+
+	// Automatically reload the page after successful upload
 	const rf = parseInt(xhr.getResponseHeader('Refresh'));
 	if (rf && ok)
 	    setTimeout(() => window.location.reload(), rf * 1000);

+ 11 - 1
esp32/www/update.html

@@ -8,7 +8,7 @@
   <body>
     <script>inc("head.html")</script>
     <h1 class="update">Update</h1>
-    <form id="upload" action="sys/fwupdate" enctype="multipart/form-data"
+    <form id="upload" class="idle" action="sys/fwupdate"
 	  method="post" onsubmit="uploadfile()">
       <fieldset class="firmware">
 	<legend>Firmware</legend>
@@ -17,6 +17,16 @@
 	<progress value="0"></progress>
       </fieldset>
       <output></output>
+      <div class="onerr">
+	<h3>Possible troubleshooting steps:</h3>
+	<ol>
+	  <li class="retry">Try again</li>
+	  <li class="jtag">Make sure no JTAG cable is plugged in</li>
+	  <li class="power">Power cycle board (remove both USB and power off ABC host)</li>
+	  <li class="esp">Separately update ESP32 over USB before trying again</li>
+	  <li class="console">Check serial console for more detailed status messages</li>
+	</ol>
+      </div>
     </form>
   </body>
 </html>

BIN
fpga/output/v1.fw


BIN
fpga/output/v2.fw