summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2022-05-21 01:10:44 -0700
committerH. Peter Anvin <hpa@zytor.com>2022-05-21 01:10:44 -0700
commitc59bb75269bb742e1320d072ff2fedc2a556f08f (patch)
tree13ce0dc5823f65c39641db2d8da31afcd9df660c
parent33ac49c4fe419ca36003c8fc7e578309f47eb844 (diff)
downloadblinktest-c59bb75269bb742e1320d072ff2fedc2a556f08f.tar.gz
blinktest-c59bb75269bb742e1320d072ff2fedc2a556f08f.tar.xz
blinktest-c59bb75269bb742e1320d072ff2fedc2a556f08f.zip
www: redirect to the status page after a configuration change
Redirect to the status page after a successful configuration change.
-rw-r--r--esp32/max80/reboot.c2
-rw-r--r--esp32/output/max80.ino.binbin793712 -> 793728 bytes
-rw-r--r--esp32/www/config.html3
-rw-r--r--esp32/www/max80.js20
-rw-r--r--esp32/www/update.html4
-rw-r--r--fpga/output/v1.fwbin747969 -> 748009 bytes
-rw-r--r--fpga/output/v2.fwbin747300 -> 747329 bytes
7 files changed, 14 insertions, 15 deletions
diff --git a/esp32/max80/reboot.c b/esp32/max80/reboot.c
index de6a5d2..d76abfd 100644
--- a/esp32/max80/reboot.c
+++ b/esp32/max80/reboot.c
@@ -11,7 +11,7 @@ void reboot_now(void)
int reboot_delayed(void)
{
- const int reboot_delay = 5; /* seconds */
+ const int reboot_delay = 3; /* seconds */
TimerHandle_t timer;
timer = xTimerCreate("reboot", configTICK_RATE_HZ*reboot_delay,
diff --git a/esp32/output/max80.ino.bin b/esp32/output/max80.ino.bin
index 9fc536e..990b17f 100644
--- a/esp32/output/max80.ino.bin
+++ b/esp32/output/max80.ino.bin
Binary files differ
diff --git a/esp32/www/config.html b/esp32/www/config.html
index 5a313d2..8dc4335 100644
--- a/esp32/www/config.html
+++ b/esp32/www/config.html
@@ -8,7 +8,8 @@
<body>
<x-inc src="head.html"></x-inc>
<h1 class="config">Configuration</h1>
- <form id="setconfig" action="sys/setconfig" method="post" onsubmit="uploadform()">
+ <form id="setconfig" action="sys/setconfig" method="post"
+ onsubmit="uploadform()" data-ref="10" data-ref-url="status.html">
<fieldset class="network">
<legend>Network</legend>
<label class="wifi-ssid">
diff --git a/esp32/www/max80.js b/esp32/www/max80.js
index b40d179..1028cd7 100644
--- a/esp32/www/max80.js
+++ b/esp32/www/max80.js
@@ -119,7 +119,8 @@ function load(url,html = false)
.catch(() => {});
}
-// POST upload of data from within a form, with progress and response text
+// POST upload of data from within a form, with (optional)
+// progress and response text, and redirect after success
function upload(form,data) {
var xhr = new XMLHttpRequest();
@@ -165,15 +166,6 @@ function upload(form,data) {
return xhr;
}
-// Upload a data file blob
-function uploadfile() {
- event.preventDefault();
- const form = event.target.form || event.target;
- var files = form.elements['file'];
- return (files.files.length == 1)
- ? upload(form,files.files[0]) : files.click();
-}
-
// key=value formatting of form data; including inverted checkboxes
function textformdata(form) {
var data = '';
@@ -196,7 +188,13 @@ function textformdata(form) {
function uploadform() {
event.preventDefault();
const form = event.target.form || event.target;
- return upload(form,textformdata(form));
+ var files = form.elements['file'];
+ if (files == undefined)
+ return upload(form,textformdata(form));
+ else if (files.files.length == 1)
+ return upload(form,files.files[0]);
+ else
+ return files.click();
}
// Flip the status of an INPUT element between text and password
diff --git a/esp32/www/update.html b/esp32/www/update.html
index a256af6..1b0f9fb 100644
--- a/esp32/www/update.html
+++ b/esp32/www/update.html
@@ -9,10 +9,10 @@
<x-inc src="head.html"></x-inc>
<h1 class="update">Update</h1>
<form id="upload" action="sys/fwupdate" method="post"
- onsubmit="uploadfile()" data-ref="10" data-ref-url="status.html">
+ onsubmit="uploadform()" data-ref="10" data-ref-url="status.html">
<fieldset class="fw">
<legend>Firmware</legend>
- <input type="file" name="file" hidden accept=".fw" onchange="uploadfile()" />
+ <input type="file" name="file" hidden accept=".fw" onchange="uploadform()" />
<button type="submit" class="fromfile" id="upload.start"
onclick="sib(this,'input').value=''">Update from file</button>
<progress value="0"></progress>
diff --git a/fpga/output/v1.fw b/fpga/output/v1.fw
index bdbde78..9eee25a 100644
--- a/fpga/output/v1.fw
+++ b/fpga/output/v1.fw
Binary files differ
diff --git a/fpga/output/v2.fw b/fpga/output/v2.fw
index 8f44c97..3e4b300 100644
--- a/fpga/output/v2.fw
+++ b/fpga/output/v2.fw
Binary files differ